add 4 new fields for expert approval

This commit is contained in:
SepehrYahyaee
2026-09-29 15:34:11 +03:30
parent b7a64596dd
commit 05e3e6a4d3
15 changed files with 1271 additions and 74 deletions
@@ -97,7 +97,7 @@ export class FanavaranSyncStage {
@Prop({ type: Number })
vehicleKindId?: number;
/** How VehicleKindId was resolved: vehicle-inquiry | car-type-lookup */
/** How VehicleKindId was resolved: expert-review | vehicle-inquiry | car-type-lookup */
@Prop({ type: String })
vehicleKindSource?: string;
@@ -124,7 +124,7 @@ export class FanavaranSyncStage {
@Prop({ type: Number })
accidentVehicleUsedId?: number;
/** How AccidentVehicleUsedId was resolved: vin-inquiry | policy-vehicle */
/** How AccidentVehicleUsedId was resolved: expert-review | vin-inquiry | policy-vehicle | vehicle-inquiry */
@Prop({ type: String })
accidentVehicleUsedSource?: string;
@@ -181,6 +181,66 @@ export class FanavaranSyncState {
export const FanavaranSyncStateSchema =
SchemaFactory.createForClass(FanavaranSyncState);
@Schema({ _id: false })
export class FanavaranVehicleLookupValue {
@Prop({ type: Number, required: true })
id: number;
@Prop({ type: String, required: true })
caption: string;
@Prop({ type: String })
name?: string;
@Prop({ type: Number })
vehicleGroupId?: number;
@Prop({ type: Number })
vehicleSystemId?: number;
@Prop({ type: String })
vehicleSystemCaption?: string;
}
export const FanavaranVehicleLookupValueSchema = SchemaFactory.createForClass(
FanavaranVehicleLookupValue,
);
@Schema({ _id: false })
export class FanavaranVehicleReview {
@Prop({ type: FanavaranVehicleLookupValueSchema, required: true })
vehicleGroup: FanavaranVehicleLookupValue;
@Prop({ type: FanavaranVehicleLookupValueSchema, required: true })
vehicleUseType: FanavaranVehicleLookupValue;
@Prop({ type: FanavaranVehicleLookupValueSchema, required: true })
vehicleSystem: FanavaranVehicleLookupValue;
@Prop({ type: FanavaranVehicleLookupValueSchema, required: true })
vehicleKind: FanavaranVehicleLookupValue;
@Prop({ type: Boolean, required: true, default: true })
approved: boolean;
@Prop({ type: Date, required: true })
approvedAt: Date;
@Prop({ type: MongooseSchema.Types.ObjectId, required: true })
approvedByActorId: Types.ObjectId;
@Prop({ type: String })
approvedByActorName?: string;
@Prop({ type: String, required: true })
approvedByRole: string;
@Prop({ type: Number, required: true, default: 1 })
version: number;
}
export const FanavaranVehicleReviewSchema = SchemaFactory.createForClass(
FanavaranVehicleReview,
);
@Schema({
collection: "claimCases",
timestamps: true,
@@ -278,6 +338,10 @@ export class ClaimCase {
@Prop({ type: FanavaranSyncStateSchema, default: () => ({}) })
fanavaranSync?: FanavaranSyncState;
/** Expert-approved Fanavaran vehicle classification used by outbound stages. */
@Prop({ type: FanavaranVehicleReviewSchema })
fanavaranVehicleReview?: FanavaranVehicleReview;
@Prop({ type: ClaimDamageSelectionSchema, default: () => ({}) })
damage?: ClaimDamageSelection;