forked from Yara724/api
Added extra fanavaran fields
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
# 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` |
|
||||
| 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 |
|
||||
|
||||
All seven 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.
|
||||
|
||||
`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; `DmgHistoryStatus` locks 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 return `409`.
|
||||
- Existing `PUT .../fanavaran-vehicle-review` additionally accepts optional `stageFields` and `stageFieldsVersion` for the initial combined approval. Older clients retain their existing behavior.
|
||||
|
||||
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 requested 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.
|
||||
@@ -36,6 +36,8 @@ The panel applies the suggestion once, displays its matched-field count and raw
|
||||
|
||||
The approval endpoint re-resolves every caption server-side and rejects inactive values or a group/use/system/kind relationship mismatch. Client-supplied captions are never trusted. A successful approval resumes base-claim submission and, when selected damage parts already exist, the damage-case stage.
|
||||
|
||||
The same tab also supports [expert editing of accident and assessment fields](fanavaran-stage-field-review.md). Initial approval can save `stageFields` with `stageFieldsVersion` atomically alongside vehicle classification, before automatic submission resumes. Fields for subsequent unsent stages remain editable independently after the vehicle classification locks.
|
||||
|
||||
## Outbound enforcement
|
||||
|
||||
Base claim, damage case, attachments, and expertise writes enforce the persisted approval. Automatic stages are deferred with a skip reason; manual stages return `409` with code `FANAVARAN_VEHICLE_REVIEW_REQUIRED`. Read-only previews remain available for diagnosis.
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
Snapshot of **what hull submit actually sends** after `toFanavaranHullBaseClaimPayload` / `toFanavaranHullExpertisePayload`.
|
||||
|
||||
Experts can now review address, city, report type, accident/culprit/authority IDs, fault percentage, repair duration and vehicle value before their sending stage. See [expert field review](../fanavaran-stage-field-review.md); defaults below remain fallbacks for unreviewed records.
|
||||
|
||||
Staged flow (VHUD):
|
||||
|
||||
1. Base: `POST /car/vehicle-hull-claims` (GEN.03)
|
||||
@@ -35,15 +37,15 @@ Built by `buildFanavaranSubmitPayload` then `enrichCarBodyHullBaseClaimPayload`
|
||||
| AccidentDate | تاریخ حادثه | string Jalali | **no** | **user** first-party `statement.accidentDate`, else createdAt |
|
||||
| AccidentTime | ساعت حادثه | string `HH:mm` | **no** | **user** `statement.accidentTime` if set |
|
||||
| AnnouncementDate | تاریخ اعلام | string Jalali | **no** | **derived** = AccidentDate |
|
||||
| AccidentLocationAddress | نشانی محل حادثه | string | **no** | **system** `"استان تهران شهر تهران"` |
|
||||
| AccidentLocationAddress | نشانی محل حادثه | string | **no** | **user** expert review, else **system** `"استان تهران شهر تهران"` |
|
||||
| AccidentCauseId | علت حادثه | number | **no** | **system** `6` · lookup `accident-causes` |
|
||||
| AccidentCityId | شهر حادثه | number | **no** | **system** `701` · lookup `cities` |
|
||||
| AccidentReportTypeId | نحوه اعلام | number | **no** | **system** `155` · lookup `accident-report-type` |
|
||||
| AccidentTypeId | نوع حادثه بدنه | number | **no** | **system** `2` تصادف(حادثه) · **lookup** `GET /lookups/vehicle-hull-accident-types` |
|
||||
| CulpritTypeId | نوع مقصر بدنه | number | **no** | **system** `300` (ثالث `337` remapped) · **lookup** `GET /lookups/vehicle-hull-accident-culprit-type` |
|
||||
| AuthorityCulpritId | مرجع تعیین مقصر | number | **no** | **lookup** `GET /lookups/detection-accident-culprits` (caption بیمهگذار, fallback `1`) |
|
||||
| AccidentCityId | شهر حادثه | number | **no** | **user** expert review, else **system** `701` · lookup `cities` |
|
||||
| AccidentReportTypeId | نحوه اعلام | number | **no** | **user** expert review, else **system** `155` · lookup `accident-report-type` |
|
||||
| AccidentTypeId | نوع حادثه بدنه | number | **no** | **user** expert review, else **system** `2` تصادف(حادثه) · **lookup** `GET /lookups/vehicle-hull-accident-types` |
|
||||
| CulpritTypeId | نوع مقصر بدنه | number | **no** | **user** expert review, else **system** `300` (ثالث `337` remapped) · **lookup** `GET /lookups/vehicle-hull-accident-culprit-type` |
|
||||
| AuthorityCulpritId | مرجع تعیین مقصر | number | **no** | **user** expert review, else **lookup** `GET /lookups/detection-accident-culprits` (caption بیمهگذار, fallback `1`) |
|
||||
| AccidentCulpritId | شناسه مقصر فناوران | number | preferred | **inquiry** parties `inquiry-by-unique-identifier`, fallback hull policy `CustomerId` |
|
||||
| CustomerFaultPercent | درصد تقصیر بیمهگذار | number | **no** | **system** `100` |
|
||||
| CustomerFaultPercent | درصد تقصیر بیمهگذار | number | **no** | **user** expert review, else **system** `100` |
|
||||
| CostSeparationToDmgSections | تفکیک هزینه به نقاط | number (ans) | **no** | **system** `0` خیر · lookup `ans` |
|
||||
| IsOwnerChanged | مالک تغییر یافته؟ | number (ans) | **no** | **system** `0` · lookup `ans` |
|
||||
| IsLicenseReplaced | گواهینامه تعویضی است؟ | number | **must be null** | never copy ثالث `IsLicenseReplacement` |
|
||||
@@ -119,8 +121,8 @@ Not ثالث GEN.08: no `DmgCaseId`, `InspectionPlaceId`, `RepairWage` on the ro
|
||||
| Wage | اجرت کل | number | **no** | **user** sum `salary` |
|
||||
| ComponentReplacementCost | قطعه کل | number | **no** | **user** sum `price` |
|
||||
| WasteValue | داغی کل | number | **no** | **user** daghi |
|
||||
| RepairDuration | مدت تعمیر (روز) | number | **no** | **system** `3` |
|
||||
| VehicleCurrentValue | ارزش روز خودرو | number | preferred | **user** `vehicle.carPrice` / `vehicle.price`, else **inquiry** policy `VehicleValue` |
|
||||
| RepairDuration | مدت تعمیر (روز) | number | **no** | **user** expert review, else **system** `3` |
|
||||
| VehicleCurrentValue | ارزش روز خودرو | number | preferred | **user** expert field review (rials), else `vehicle.carPrice` / `vehicle.price`, else **inquiry** policy `VehicleValue` |
|
||||
| DropAmount | افت قیمت | number | **no** | **user** price-drop total or `0` |
|
||||
| CarryAndRescueCost | حمل و نجات | number | yes | null |
|
||||
| WreckHighestValue | بالاترین ارزش لاشه | number | yes | null |
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
Snapshot of **what `ClaimRequestManagementService` actually sends** for `THIRD_PARTY` as of this version.
|
||||
|
||||
Experts can now override address, city, report type, damage history and inspection place before their sending stage. See [expert field review](../fanavaran-stage-field-review.md); defaults below remain fallbacks for unreviewed records.
|
||||
|
||||
- Base: `POST /car/third-party-car-financial-claims` (GEN.03)
|
||||
- Damage case: `POST …/{claimId}/dmg-cases` (GEN.12)
|
||||
- Attachments: `POST …/{claimId}/files` (GEN.07, multipart)
|
||||
@@ -38,10 +40,10 @@ Parsian tenant defaults used below: `ClaimExpertId=154`, `ExpertiseClaimExpertId
|
||||
| AnnouncementDate | تاریخ اعلام | string Jalali | **no** | **derived** = AccidentDate | |
|
||||
| DocReceivedDate | تاریخ وصول مدارک | string Jalali | **no** | **derived** = AccidentDate | Third-party only (not on hull whitelist) |
|
||||
| AccidentTime | ساعت حادثه | string `HH:mm` | **no** | **user** / **derived** from createdAt | |
|
||||
| AccidentLocationAddress | نشانی محل حادثه | string | **no** | **system** `"استان تهران شهر تهران"` | Should later be **user** |
|
||||
| AccidentLocationAddress | نشانی محل حادثه | string | **no** | **user** expert review, else **system** `"استان تهران شهر تهران"` | |
|
||||
| AccidentCauseId | علت حادثه | number | **no** | **system** `6` | Lookup: `GET /lookups/accident-causes`. Expert `accidentReason.fanavaran` exists but is not yet wired as the sent id |
|
||||
| AccidentCityId | شهر محل حادثه | number | **no** | **system** `701` تهران | Lookup: `GET /lookups/cities` |
|
||||
| AccidentReportTypeId | نحوه اعلام حادثه | number | **no** | **system** `155` | Lookup: `GET /lookups/accident-report-type` |
|
||||
| AccidentCityId | شهر محل حادثه | number | **no** | **user** expert review, else **system** `701` تهران | Lookup: `GET /lookups/cities` |
|
||||
| AccidentReportTypeId | نحوه اعلام حادثه | number | **no** | **user** expert review, else **system** `155` | Lookup: `GET /lookups/accident-report-type` |
|
||||
| AccidentVehicleUsedId | نوع کاربری خودرو | number | **no** | **inquiry** VIN / policy vehicle `UsedId`, else tenant `1` | Lookup: `GET /lookups/vehicle-use-types` |
|
||||
| CulpritTypeId | نوع مقصر | number | **no** | **system** `337` | Lookup: `GET /lookups/accident-culprit-type` (ثالث, not hull) |
|
||||
| CulpritLicenceTypeId | نوع گواهینامه مقصر | number | **no** | **system** `2` | Lookup: `GET /lookups/driving-licence-types` |
|
||||
@@ -127,7 +129,7 @@ If `DriverId` is missing, **submit** (not preview) registers GEN.44 `POST /commo
|
||||
| PreviousPolicyEndDate | پایان بیمهنامه قبلی | string | empty ok | **derived** from EndDate |
|
||||
| InsuranceCorpId | شرکت بیمه زیاندیده | number | **no** | **lookup** insurance-corp for tenant |
|
||||
| DmgCaseTypeId | نوع مورد خسارت | number | **no** | **system** `175` · lookup `dmg-case-type` |
|
||||
| DmgHistoryStatus | وضعیت سابقه خسارت | number | **no** | **system** `5214` · lookup `dmg-history-status` |
|
||||
| DmgHistoryStatus | وضعیت سابقه خسارت | number | **no** | **user** expert review, else **system** `5214` · lookup `dmg-history-status` |
|
||||
| FaultPercent | درصد تقصیر | number | **no** | **system** `100` |
|
||||
| DriverIsOwner | راننده همان مالک؟ | number | **no** | **user** `driverIsInsurer` → 1/0 |
|
||||
| LicenceNo | شماره گواهینامه زیاندیده | string | **no** | **user**, else dummy |
|
||||
@@ -169,7 +171,7 @@ Requires local `dmgCaseId`. `ClaimExpertId` here is the **assessor** role (Parsi
|
||||
| ClaimExpertId | کارشناس ارزیاب | number | **no** | **staff** / tenant `ExpertiseClaimExpertId` |
|
||||
| DmgAssessmentDate | تاریخ بازدید | string Jalali | **no** | **derived** expert reply `submittedAt` |
|
||||
| InspectionTime | ساعت بازدید | string `HH:mm` | **no** | **derived** |
|
||||
| InspectionPlaceId | محل بازدید | number | **no** | **system** `282` · lookup `GET /lookups/inspection-place` |
|
||||
| InspectionPlaceId | محل بازدید | number | **no** | **user** expert review, else **system** `282` · lookup `GET /lookups/inspection-place` |
|
||||
| RepairWage | اجرت کل | number | **no** | **user** sum of part `salary` |
|
||||
| ComponentReplacementCost | قطعه کل | number | **no** | **user** sum of part `price` |
|
||||
| WasteValue | داغی کل | number | **no** | **user** daghi prices |
|
||||
|
||||
Reference in New Issue
Block a user