Add 5-second auto-refresh for dashboard Activity feed
All checks were successful
Build and Push Docker Image / build (push) Successful in 9m0s
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:
@@ -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 } },
|
||||
},
|
||||
})
|
||||
}),
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user