forked from Yara724/api
Accept and persist address-only locations across user and expert flows, preserve workflow authorization, and include addresses in reports and Fanavaran review. Expose persisted final submission completion so the expert panel can prevent repeat sends.
43 lines
2.1 KiB
Markdown
43 lines
2.1 KiB
Markdown
# Accident location without GPS
|
||
|
||
Location steps accept either a real latitude/longitude pair or a written accident
|
||
address. Existing coordinate clients remain supported. No migration is needed.
|
||
|
||
```json
|
||
{ "address": "تهران، خیابان آزادی، روبهروی دانشگاه" }
|
||
```
|
||
|
||
```json
|
||
{ "lat": 35.6892, "lon": 51.389 }
|
||
```
|
||
|
||
An address is trimmed and must contain 10–1000 characters. Both coordinates must
|
||
be finite numbers within valid ranges if supplied. Empty input, incomplete
|
||
coordinates and invalid addresses produce Persian errors. Unknown properties
|
||
are discarded. The existing party ownership, role and workflow checks still run.
|
||
|
||
The same contract covers the normal user/v6 location endpoint, the expert
|
||
mirror endpoints (v2/v3) and optional v4/v5 location submissions. The expert panel
|
||
IN_PERSON endpoint wraps the value as `{ "location": { "address": "..." } }`.
|
||
V4/v5 still skip location and do not gain a new mandatory step.
|
||
|
||
The user form always offers a written-address field, including while GPS is
|
||
pending or denied and when map tiles fail. Typed addresses take precedence over
|
||
GPS, since the current device position may differ from the accident scene.
|
||
The initial map centre is only a viewport and is never automatically submitted.
|
||
Dragging or clicking the map is an explicit selection. Pending location data is
|
||
reset when switching cases or parties; saved addresses count as completed
|
||
location evidence on resume.
|
||
|
||
`parties[].location.address` persists through the shared location schema, claim
|
||
snapshots and detail responses. The expert panel and exported case report show
|
||
the address even without coordinates. The Fanavaran address review is populated
|
||
from the recorded address when available; previously reviewed/sent values keep
|
||
precedence. Existing GPS-only Fanavaran behavior is unchanged.
|
||
|
||
Checks: `accident-location.spec.ts`, `call-center-v6-workflow.spec.ts`,
|
||
`file-maker-blame-v4-workflow.spec.ts`, `case-expert-report.builder.spec.ts`,
|
||
`fanavaran-stage-fields.spec.ts`; UI `test-location-fallback.cjs` and
|
||
`test-accident-detail.cjs` cover GPS errors, late GPS, saved addresses and user/
|
||
expert location orchestration across v1/v2/v3/v6.
|