6.3 KiB
Expert editing of Fanavaran stage fields
The expert panel's existing Fanavaran review tab now includes accident and assessment fields, alongside the four vehicle classification fields. All supported expert-panel roles use the existing claim-detail authorization and tenant/assignment/branch checks.
Supported fields and lookups
| Field | Case type | Sending stage | Input / lookup |
|---|---|---|---|
| AccidentLocationAddress | Both | Base claim | Non-empty address, up to 1,000 characters |
| AccidentCityId | Both | Base claim | cities |
| AccidentReportTypeId | Both | Base claim | accident-report-type |
| NotifierTypeId | Both, TejaratNo only | Base claim | Supplied notifier-type IDs 5516 / 5517; 5518 is excluded |
| NotifierRelationId | Both, TejaratNo only | Base claim | Supplied notifier-relation IDs 5519–5526 |
| DmgHistoryStatus | Third-party | Damage case | dmg-history-status (dmg-case-history-status upstream) |
| InspectionPlaceId | Third-party | Expertise | inspection-place |
| AccidentTypeId | Car-body | Base claim | vehicle-hull-accident-types |
| CulpritTypeId | Car-body | Base claim | vehicle-hull-accident-culprit-type; never the third-party culprit codebook |
| AuthorityCulpritId | Car-body | Base claim | detection-accident-culprits |
| CustomerFaultPercent | Car-body | Base claim | Integer 0–100, including zero |
| RepairDuration | Car-body | Expertise | Positive integer days |
| VehicleCurrentValue | Car-body | Expertise | Positive integer rials, forwarded unchanged |
The seven original remote lookup definitions already existed. Options use the deployment's active Fanavaran client and its existing live/cache lookup service. Only active canonical Id values are accepted; captions are resolved server-side. Array and nested data lookup envelopes are supported. Missing/empty lookups are shown as unavailable and cannot be replaced with guessed IDs.
TejaratNo notifier review
For the configured deployment tenant tejaratno (FANAVARAN_CLIENT, case-insensitive), the same tab shows نوع اعلامکننده and نسبت اعلامکننده. The API supplies and validates the tenant-provided IDs/captions directly; these two lists do not depend on a remote fetch or a guessed Fanavaran lookup URL. They are also available through the existing GET /lookups/fanavaran/notifier-type and GET /lookups/fanavaran/notifier-relation routes for this tenant. Other tenants cannot edit or request these tenant-specific fields.
Neither selection has a guessed default. Both must be saved before initial vehicle approval/initial Fanavaran submission. Initial combined approval saves the IDs, captions and history atomically. Missing or excluded values cannot bypass the rule through old clients or manual submission: manual initial submission returns 409 with FANAVARAN_NOTIFIER_REVIEW_REQUIRED; automatic submission skips until the fields are reviewed. Already approved, unsent claims can save them with the existing versioned field PATCH endpoint. Saving fields alone does not send a remote request.
The selections are sent as NotifierTypeId / NotifierRelationId on GEN.03 for both third-party and car-body claims. Hull filtering preserves them only for TejaratNo. They lock once the base stage is sent. Existing submitted claims remain usable without a migration; submitted notifier values are preserved on subsequent hull synchronization, and unknown legacy values are not overwritten with null.
The notifier payload property names follow the proposed contract; the tenant did not provide an upstream schema. Live Fanavaran acceptance must be verified in tenant QA. No remote writes are performed by regression tests.
VehicleCurrentValue can remain unset when no expert override exists, preserving the existing case-value/policy-value fallback. A stored override cannot be cleared with null or an empty string. This review does not change the application's other valuation fields or calculate price drop.
Sending and editing
- The initial vehicle approval accepts the applicable stage fields in the same database update. Only after that update does the existing automatic base/damage submission resume. The new panel requires valid fields and explicit consent before initial approval.
- For already approved cases, experts save changes independently, before the relevant stage is sent. Saving fields does not itself perform a remote write.
- Base fields lock when the base claim exists;
DmgHistoryStatuslocks when the damage case exists; assessment fields lock when expertise exists. Stage IDs and successful sync states are checked in both validation and the conditional database update. - Car-body still skips damage-case creation, sends only its base/expertise whitelist, and retains required null values. Third-party payloads retain their existing explicit null keys.
- No attempt is made to edit already sent base fields through the unreliable hull PUT route.
Endpoints and persistence
GET /v2/expert-claim/request/:id/fanavaran-stage-fields: applicable field definitions, current/default/submitted values, captions, compact lookup rows and per-field editability. This read does not submit a claim or persist a preview.PATCH /v2/expert-claim/request/:id/fanavaran-stage-fields:{ values: { ...changedFields }, expectedVersion: 0, confirmed: true }. Values must apply to the product and belong to an unsent stage. Stale versions or stages sent during validation return409.- Existing
PUT .../fanavaran-vehicle-reviewadditionally accepts optionalstageFieldsandstageFieldsVersionfor the initial combined approval. Older clients retain their existing behavior for other tenants; TejaratNo requires the two notifier selections before initial approval.
Validated overrides and captions are stored in optional claimCases.fanavaranFieldReview, with version, reviewer and review timestamp. History events record before/after values and verified captions. Existing claims keep their existing defaults/fallbacks until reviewed; no migration or bulk data rewrite is required.
The review covers the eleven original requested fields, the two TejaratNo-only notifier fields and the existing vehicle classification. It does not expose derived totals, provider identifiers, staff-role identifiers or every remaining field in the stage documents for arbitrary editing.