feat: backfill file hashes for existing documents (#56) #59
Reference in New Issue
Block a user
Delete Branch "feature/56-backfill-file-hashes"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Adds a one-shot admin action that computes SHA-256 hashes for all documents that were uploaded before the #55 migration. Without this, those documents would always show the "outdated annotations" notice and their annotations would be hidden.
FileService.downloadFileBytes()— downloads raw bytes from S3 for hash computationAnnotationService.backfillAnnotationFileHashForDocument()— sets the document hash on any annotation that still hasfileHash = NULLDocumentService.backfillFileHashes()— iterates all(fileHash IS NULL, filePath IS NOT NULL)documents, downloads, hashes, saves, then propagates the hash to annotations; skips gracefully on S3 errorsPOST /api/admin/backfill-file-hashes— new endpoint inAdminController, protected byADMINpermission, returns{ count }like the existingbackfill-versionsendpointTest plan
./mvnw test)svelte-checkintroduces no new type errorsadmin triggers file hash backfill and sees success message— navigates to System tab, clicks button, success counter appearsDepends on #55 (branched from
feature/55-file-hash-annotations).Closes #56