fix: recover saved photo uploads and lower car-body description minimum

Read saved document status from maps and plain objects, acknowledge verified document retries without replacing stored images, and preserve upload authorization and resend behavior. Lower the car-body narrative minimum to 30 characters with Persian errors and boundary regression coverage.
This commit is contained in:
SepehrYahyaee
2026-11-21 12:35:49 +03:30
parent 8f15040080
commit e33f5736a2
12 changed files with 202 additions and 29 deletions
+37
View File
@@ -0,0 +1,37 @@
# Recovering already-saved photos during capture
The capture-requirements endpoint now reads `requiredDocuments` from both
Mongoose Maps and ordinary objects. The object case previously returned
`uploaded: false` even for a saved chassis/engine photo, causing the UI to
request it again and encounter the duplicate-document conflict.
Initial `upload-document` retries now acknowledge an existing uploaded document
when a saved file path/URL is present. The response contains the existing
`fileUrl`, the current persisted workflow step and `alreadyUploaded: true`.
Ownership/tenant checks still run first. This does not replace the saved image,
create a second document reference, append duplicate history, or resend the
attachment to Fanavaran. A flag without file evidence is not acknowledged.
Expert resends and active in-person replacement uploads keep their existing
validation paths. Expert capture-document retries after the capture phase
advanced can reuse confirmed evidence after the same ownership checks.
The user camera and gallery pages read saved part/angle/document flags, offer
Continue for those slots without requiring another photo, and keep locally
successful photo uploads separate from video completion. If the last photo
saves but video upload fails, retrying completion only retries the video; it
cannot re-upload the chassis image and encounter a duplicate error. Local photo
receipts are scoped to the claim, and field-expert uploads await the selected
API promise before recording success or advancing. The version was previously
awaited instead of the upload promise in several conditional API calls.
The camera still records and submits the required walk-around video. Missing
images and actual API failures remain blocking; error text or HTTP 409 alone is
never treated as evidence of a successful upload.
Verification:
- API: `upload-document-idempotency.spec.ts`, `capture-part-concurrency.spec.ts`,
`claim-capture-phase.spec.ts`, `ai-capture-integration.spec.ts`.
- UI: `scripts/test-capture-upload-recovery.cjs`, included in `npm run test:ui`;
covers saved chassis/parts, failed-video retry, awaited/rejected expert
requests, case isolation and camera/gallery implementations.