Add human-readable reshuffle details to audit log page
All checks were successful
Build and Push Docker Image / build (push) Successful in 9m50s

Audit log now renders JUROR_DROPOUT_RESHUFFLE and COI_REASSIGNMENT
entries as formatted tables with resolved juror names instead of raw
JSON with opaque IDs. Uses new user.resolveNames endpoint to batch-
lookup user IDs. Also adds missing action types to the filter dropdown.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Matt
2026-02-20 14:23:10 +01:00
parent 0d0571ebf2
commit 34fdd0ba8e
2 changed files with 170 additions and 6 deletions

View File

@@ -360,6 +360,25 @@ export const userRouter = router({
return user
}),
/**
* Resolve a batch of user IDs to names (admin only).
* Returns a map of id → name for displaying in audit logs, etc.
*/
resolveNames: adminProcedure
.input(z.object({ ids: z.array(z.string()).max(50) }))
.query(async ({ ctx, input }) => {
if (input.ids.length === 0) return {}
const users = await ctx.prisma.user.findMany({
where: { id: { in: input.ids } },
select: { id: true, name: true, email: true },
})
const map: Record<string, string> = {}
for (const u of users) {
map[u.id] = u.name || u.email
}
return map
}),
/**
* Create/invite a new user (admin only)
*/