Add 5-second auto-refresh for dashboard Activity feed
All checks were successful
Build and Push Docker Image / build (push) Successful in 9m0s

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-23 17:15:42 +01:00
parent feccd269f7
commit ab2c73bad2
2 changed files with 23 additions and 1 deletions

View File

@@ -553,4 +553,22 @@ export const dashboardRouter = router({
return evaluations
}),
getRecentActivity: adminProcedure
.input(z.object({ limit: z.number().int().min(1).max(20).optional() }))
.query(async ({ ctx, input }) => {
const sevenDaysAgo = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000)
return ctx.prisma.auditLog.findMany({
where: { timestamp: { gte: sevenDaysAgo } },
orderBy: { timestamp: 'desc' },
take: input.limit ?? 8,
select: {
id: true,
action: true,
entityType: true,
timestamp: true,
user: { select: { name: true } },
},
})
}),
})