automatiacally previous stages submitted

This commit is contained in:
2026-11-11 18:36:10 +03:30
parent 84b92eb55a
commit 8b9dabc9f2
8 changed files with 437 additions and 23 deletions
@@ -68,3 +68,37 @@ To verify remote receipts directly, use
`GET /v2/fanavaran/parsian/claim-cases/{claimCaseId}/hull/files`.
Retrieve one image and its Base64 content using `/hull/files/{fileId}`.
See [hull retrieval](hull-retrieval.md) for all supported read routes.
## Expertise submit completes missing prerequisites
The frontend can call
`POST /v2/fanavaran/{client}/claim-cases/{claimCaseId}/expertise/submit`
without separately retrying earlier stages. The backend completes them in order:
- Third-party: base claim → damage case → pending attachments → expertise.
- Hull: base claim → pending attachments → expertise. Hull has no damage-case stage.
Existing claim/damage IDs and successful image receipts are reused. A previously
skipped attachment stage is retried. Completion is checked against a fresh read
of the saved receipts for all current local image candidates, not just the
attachment stage's status or an upload response saying success. Missing local
files, rejected uploads, and unconfirmed receipts stop expertise submission.
If there are no local attachment candidates, there is nothing to upload.
Errors identify `stage` (`baseClaim`, `damageCase`, or `attachments`) and preserve
vendor details. An attachment failure includes:
```json
{
"statusCode": 400,
"code": "FANAVARAN_ATTACHMENTS_INCOMPLETE",
"stage": "attachments",
"pendingFiles": [
{ "fileName": "image.jpg", "error": "Upload failure reason", "skipped": false }
]
}
```
Retrying resumes pending work. Even when expertise already exists, this API first
repairs missing prerequisites, then returns the existing expertise response/Id
without posting another expertise. Automatic final writes also check attachments.