Files
yara724-api/docs/fanavaran/attachment-upload-status.md
T

71 lines
3.0 KiB
Markdown

# Fanavaran image receipts and upload failures
The image ID is the external `Id` returned by Fanavaran's attachment upload, not
the MongoDB ID of the local image. Both batch and single-image uploads persist it
in `claimCases.fanavaranSync.attachments.files[].fileId`, together with `fileName`,
`source`, `submittedAt`, and the response. Per-image success, failure, and skip
events are saved in `fanavaranSync.attachments.attempts`. Failures include an error
and, when an audited HTTP upload started, a tracking code.
## Read the IDs beside the claim references
Claim detail responses that expose `fanavaran` now include:
```json
{
"fanavaran": {
"claimId": 5190845,
"fileIds": [700001],
"attachments": {
"status": "success",
"uploadedCount": 1,
"lastError": null,
"files": [
{
"fileId": 700001,
"fileName": "image.jpg",
"source": "capture:angle:front"
}
],
"attempts": []
}
}
}
```
Existing claim-reference codes remain gated on COMPLETED. Image receipts and
status can appear earlier. The expertise preview also returns `fileIds` and
`attachments` beside `claimId`, `dmgCaseId`, and `expertiseId`.
## Check every planned image and why it is pending
`GET /v2/fanavaran/parsian/claim-cases/{claimCaseId}/attachments/preview`
This returns `totalLocalImages`, `alreadySubmitted`, `pendingSubmit`, `fileIds`,
`uploadStatus`, and one `attachments` row per local upload candidate. Each row
includes `fileId`, `alreadySubmitted`, `localFileExists`, `status`, and `lastError`.
Use `pendingSubmit` to check whether all current local candidates have saved
receipts. Summary status describes recorded outcomes, not unattempted images.
- `success`: confirmed external file IDs are recorded.
- `partial`: receipts exist, but another recorded image failed or was skipped.
- `failed` / `skipped`: inspect the per-image error and `nextRetryAt` if present.
- `not_recorded`: no upload outcome is stored; this is not proof of remote absence.
- `unconfirmed`: legacy upload records have no valid external file ID.
`POST /v2/fanavaran/parsian/claim-cases/{claimCaseId}/attachments/submit` submits
pending candidates and returns each upload's `fileId` or failure/skip reason.
Already-recorded successful uploads are skipped. Missing local files are reported
instead of silently excluded. A response with no external file ID is unconfirmed
and is not automatically retried, to avoid duplicating a possibly accepted upload.
Older batch uploads did not persist their returned IDs. This change cannot
reconstruct those historical receipts from the local database; verify them with
Fanavaran before deciding to re-upload. New uploads use the shared persistence
path and record their outcomes.
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.