Files
yara724api/src/claim-request-management/entites/schema/claim-case.damage.schema.ts
SepehrYahyaee e90f8dc33c YARA-833
2026-04-27 17:03:29 +03:30

50 lines
1.4 KiB
TypeScript

import { Prop, Schema, SchemaFactory } from "@nestjs/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']
*/
@Prop({ type: [String], default: [] })
selectedParts?: string[];
/** Structured selected outer parts with id + side for better downstream handling. */
@Prop({ type: [SelectedOuterPartV2Schema], default: [] })
selectedOuterParts?: SelectedOuterPartV2[];
/**
* V2: Array of selected other (non-body) damaged parts
* Examples: ['engine', 'suspension', 'headlight']
*/
@Prop({ type: [String], default: [] })
otherParts?: string[];
/**
* Legacy fields - kept for backward compatibility
*/
@Prop({ type: [CarDamagePartModel] })
legacyParts?: CarDamagePartModel[];
@Prop({ type: CarDamagePartOtherModel })
legacyOtherParts?: CarDamagePartOtherModel;
}
export const ClaimDamageSelectionSchema =
SchemaFactory.createForClass(ClaimDamageSelection);