Fixed claim/blame damagedParts

This commit is contained in:
2026-05-03 13:54:48 +03:30
parent c2d59112cf
commit c579f8fa1d
16 changed files with 1347 additions and 299 deletions

View File

@@ -1,32 +1,15 @@
import { Prop, Schema, SchemaFactory } from "@nestjs/mongoose";
import { Schema as MongooseSchema } from "mongoose";
import { CarDamagePartModel, CarDamagePartOtherModel } from "./car-parts.schema";
@Schema({ _id: false })
export class SelectedOuterPartV2 {
@Prop({ type: Number })
id: number;
@Prop({ type: String })
key: string;
@Prop({ type: String })
side: string;
}
export const SelectedOuterPartV2Schema =
SchemaFactory.createForClass(SelectedOuterPartV2);
@Schema({ _id: false })
export class ClaimDamageSelection {
/**
* V2: Array of selected damaged outer car part names
* Examples: ['hood', 'front_right_door', 'rear_bumper']
* V2: Selected outer damaged parts (ordered). Prefer objects
* `{ id, name, side, label_fa, catalogKey? }`; legacy string keys are still accepted until migrated.
*/
@Prop({ type: [String], default: [] })
selectedParts?: string[];
/** Structured selected outer parts with id + side for better downstream handling. */
@Prop({ type: [SelectedOuterPartV2Schema], default: [] })
selectedOuterParts?: SelectedOuterPartV2[];
@Prop({ type: [MongooseSchema.Types.Mixed], default: [] })
selectedParts?: unknown[];
/**
* V2: Array of selected other (non-body) damaged parts
@@ -46,4 +29,3 @@ export class ClaimDamageSelection {
}
export const ClaimDamageSelectionSchema =
SchemaFactory.createForClass(ClaimDamageSelection);