feat(ocr): discard abandoned capture batches
A bad scan, the wrong PDFs or a duplicate upload used to leave a batch sitting in READY_FOR_REVIEW forever, because the only exits were confirm (posts to the books) or rejecting every page one at a time. Add a DISCARDED terminal status to both OCR domains and a single endpoint per domain that rejects every page still pending in one shot. Discarding is refused once anything has landed: statements once a page is POSTED, policies once a page is APPLIED. Those batches did real work and have to be settled page by page. - POST /statements/batches/:id/discard - POST /policy-ocr/batches/:id/discard - shared DiscardBatchCard on both review screens, gated the same way
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
-- Add DISCARDED to both OCR batch status enums. Staff can now abandon a
|
||||
-- pending review queue outright instead of leaving it stuck in
|
||||
-- READY_FOR_REVIEW forever (rejecting every page never closed the batch).
|
||||
-- Purely additive: no existing row changes value.
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `policy_ocr_batches`
|
||||
MODIFY `status` ENUM('UPLOADED', 'PROCESSING', 'READY_FOR_REVIEW', 'COMPLETED', 'FAILED', 'DISCARDED') NOT NULL DEFAULT 'UPLOADED';
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `statement_batches`
|
||||
MODIFY `status` ENUM('UPLOADED', 'PROCESSING', 'READY_FOR_REVIEW', 'COMPLETED', 'FAILED', 'DISCARDED') NOT NULL DEFAULT 'UPLOADED';
|
||||
@@ -399,6 +399,10 @@ enum PolicyOcrBatchStatus {
|
||||
READY_FOR_REVIEW
|
||||
COMPLETED
|
||||
FAILED
|
||||
/// Abandoned by staff before anything was applied — a bad scan, the wrong
|
||||
/// PDFs, a duplicate upload. Distinct from COMPLETED so the queue can tell
|
||||
/// "we did the work" from "we threw it away".
|
||||
DISCARDED
|
||||
}
|
||||
|
||||
/// One parsed policy page — one Policy → one Customer (after staff confirms).
|
||||
@@ -573,6 +577,10 @@ enum StatementBatchStatus {
|
||||
READY_FOR_REVIEW
|
||||
COMPLETED
|
||||
FAILED
|
||||
/// Abandoned by staff before anything was posted — a bad scan, the wrong
|
||||
/// PDFs, a duplicate upload. Distinct from COMPLETED so the queue can tell
|
||||
/// "we did the work" from "we threw it away".
|
||||
DISCARDED
|
||||
}
|
||||
|
||||
enum StatementDocumentStatus {
|
||||
|
||||
Reference in New Issue
Block a user