Add schema reconciliation migration and file removal in bulk upload
All checks were successful
Build and Push Docker Image / build (push) Successful in 7m38s
All checks were successful
Build and Push Docker Image / build (push) Successful in 7m38s
Migration: - Add standalone hasConflict index on ConflictOfInterest - Ensure roundId is nullable on ConflictOfInterest - Drop stale composite roundId_hasConflict index Bulk upload: - Add trash icon button to remove uploaded files - Uses existing file.delete endpoint with audit logging Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -47,6 +47,7 @@ import {
|
||||
FileUp,
|
||||
AlertCircle,
|
||||
ExternalLink,
|
||||
Trash2,
|
||||
} from 'lucide-react'
|
||||
import { cn, formatFileSize } from '@/lib/utils'
|
||||
import { Pagination } from '@/components/shared/pagination'
|
||||
@@ -155,6 +156,26 @@ export default function BulkUploadPage() {
|
||||
[utils, refetch]
|
||||
)
|
||||
|
||||
// Delete a file
|
||||
const deleteMutation = trpc.file.delete.useMutation({
|
||||
onSuccess: () => {
|
||||
toast.success('File removed')
|
||||
refetch()
|
||||
},
|
||||
onError: (err) => {
|
||||
toast.error(`Failed to remove file: ${err.message}`)
|
||||
},
|
||||
})
|
||||
|
||||
const handleDeleteFile = useCallback(
|
||||
(fileId: string) => {
|
||||
if (confirm('Remove this uploaded file?')) {
|
||||
deleteMutation.mutate({ id: fileId })
|
||||
}
|
||||
},
|
||||
[deleteMutation]
|
||||
)
|
||||
|
||||
const uploadMutation = trpc.file.adminUploadForRoundRequirement.useMutation()
|
||||
|
||||
// Upload a single file for a project requirement
|
||||
@@ -513,7 +534,20 @@ export default function BulkUploadPage() {
|
||||
</div>
|
||||
) : req.file || uploadState?.status === 'complete' ? (
|
||||
<div className="flex flex-col items-center gap-1">
|
||||
<CheckCircle2 className="h-4 w-4 text-green-600" />
|
||||
<div className="flex items-center gap-1">
|
||||
<CheckCircle2 className="h-4 w-4 text-green-600" />
|
||||
{req.file && (
|
||||
<button
|
||||
type="button"
|
||||
className="text-muted-foreground hover:text-destructive transition-colors cursor-pointer"
|
||||
title="Remove file"
|
||||
onClick={() => handleDeleteFile(req.file!.id)}
|
||||
disabled={deleteMutation.isPending}
|
||||
>
|
||||
<Trash2 className="h-3 w-3" />
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
{req.file?.bucket && req.file?.objectKey ? (
|
||||
<button
|
||||
type="button"
|
||||
|
||||
Reference in New Issue
Block a user