Auto-transition projects to PASSED when all required documents uploaded
All checks were successful
Build and Push Docker Image / build (push) Successful in 7m55s
All checks were successful
Build and Push Docker Image / build (push) Successful in 7m55s
Add checkRequirementsAndTransition() to round-engine that checks if all required FileRequirements for a round are satisfied by uploaded files. When all are met and the project is PENDING/IN_PROGRESS, it auto- transitions to PASSED. Also adds batchCheckRequirementsAndTransition() for bulk operations. Wired into: - file.adminUploadForRoundRequirement (admin bulk upload) - applicant.saveFileMetadata (applicant self-upload) Non-fatal: failures in the check never break the upload itself. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -3,6 +3,7 @@ import { TRPCError } from '@trpc/server'
|
||||
import { router, protectedProcedure, adminProcedure } from '../trpc'
|
||||
import { getPresignedUrl, generateObjectKey, deleteObject, BUCKET_NAME } from '@/lib/minio'
|
||||
import { logAudit } from '../utils/audit'
|
||||
import { checkRequirementsAndTransition } from '../services/round-engine'
|
||||
|
||||
export const fileRouter = router({
|
||||
/**
|
||||
@@ -1501,6 +1502,14 @@ export const fileRouter = router({
|
||||
userAgent: ctx.userAgent,
|
||||
})
|
||||
|
||||
// Auto-transition: check if all required documents are now uploaded
|
||||
await checkRequirementsAndTransition(
|
||||
input.projectId,
|
||||
input.roundId,
|
||||
ctx.user.id,
|
||||
ctx.prisma,
|
||||
)
|
||||
|
||||
return { uploadUrl, file }
|
||||
}),
|
||||
|
||||
|
||||
Reference in New Issue
Block a user