feat(final-docs): finalist document review service + procedure with finale-access gate
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -19,7 +19,7 @@ import {
|
||||
resetOrCreatePendingConfirmation,
|
||||
confirmAttendanceInTx,
|
||||
} from '../services/finalist-enrollment'
|
||||
import { sendManualFinalDocReminders } from '../services/final-documents'
|
||||
import { sendManualFinalDocReminders, listFinalistDocumentsForReview, userCanReviewFinals } from '../services/final-documents'
|
||||
|
||||
export const finalistRouter = router({
|
||||
/** List all per-category finalist slot quotas for a program. */
|
||||
@@ -1681,4 +1681,13 @@ export const finalistRouter = router({
|
||||
})
|
||||
return result
|
||||
}),
|
||||
|
||||
/** Read-only review of all finalists' grand-final documents (admins + finale jury). */
|
||||
listReviewDocuments: protectedProcedure
|
||||
.input(z.object({ programId: z.string() }))
|
||||
.query(async ({ ctx, input }) => {
|
||||
const allowed = await userCanReviewFinals(ctx.prisma, ctx.user.id, ctx.user.role, input.programId)
|
||||
if (!allowed) throw new TRPCError({ code: 'FORBIDDEN', message: 'You do not have access to the finalist documents review.' })
|
||||
return listFinalistDocumentsForReview(ctx.prisma, input.programId)
|
||||
}),
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user