Fix project detail 500 error and round deletion data integrity

- Add missing migration for FileRequirement table and ProjectFile.requirementId
  column (existed in Prisma schema but had no migration, causing all queries
  with `include: { files: true }` to fail with column not found)
- Make projectTags query resilient with try-catch in project.get
- Reset project status to SUBMITTED when round is deleted (prevents orphaned
  ASSIGNED status after ON DELETE SET NULL nullifies roundId)
- Fix round creation/update to allow requiredReviews=0 for filtering rounds
- Parse Zod validation errors in round creation error display

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-11 00:20:28 +01:00
parent 0631dbb64f
commit 7e3d600eed
4 changed files with 65 additions and 11 deletions

View File

@@ -417,7 +417,20 @@ function CreateRoundContent() {
<CardContent className="flex items-center gap-2 py-4">
<AlertCircle className="h-5 w-5 text-destructive" />
<p className="text-sm text-destructive">
{createRound.error.message}
{(() => {
const msg = createRound.error.message
try {
const parsed = JSON.parse(msg)
if (Array.isArray(parsed)) {
return parsed.map((e: { message?: string; path?: string[] }) =>
e.message || 'Validation error'
).join('. ')
}
} catch {
// Not JSON, use as-is
}
return msg
})()}
</p>
</CardContent>
</Card>