Make bulk upload documents clickable with storage verification
All checks were successful
Build and Push Docker Image / build (push) Successful in 8m2s

- Add bucket/objectKey to file select in listProjectsByRoundRequirements
- Add verifyFilesExist endpoint to bulk-check file existence in MinIO
- Make uploaded filenames clickable links that open presigned download URLs
- Verify files exist in storage on page load, show re-upload button if missing

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Matt
2026-02-16 13:32:23 +01:00
parent c707899179
commit 85a0fa5016
2 changed files with 119 additions and 6 deletions

View File

@@ -1295,6 +1295,8 @@ export const fileRouter = router({
size: true,
createdAt: true,
requirementId: true,
bucket: true,
objectKey: true,
},
},
},
@@ -1487,4 +1489,37 @@ export const fileRouter = router({
return { uploadUrl, file }
}),
/**
* Verify that files actually exist in storage (MinIO/S3).
* Returns a map of objectKey → exists boolean.
*/
verifyFilesExist: adminProcedure
.input(
z.object({
files: z.array(
z.object({
bucket: z.string(),
objectKey: z.string(),
})
).max(200),
})
)
.query(async ({ input }) => {
const { getMinioClient } = await import('@/lib/minio')
const client = getMinioClient()
const results: Record<string, boolean> = {}
await Promise.all(
input.files.map(async ({ bucket, objectKey }) => {
try {
await client.statObject(bucket, objectKey)
results[objectKey] = true
} catch {
results[objectKey] = false
}
})
)
return results
}),
})