forked from Yara724/api
merge upstream
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||
import { BlameRequestType } from 'src/Types&Enums/blame-request-management/blameRequestType.enum';
|
||||
import { DamageSelectedPartV2BodyDto } from 'src/claim-request-management/dto/damage-selected-part-v2.dto';
|
||||
|
||||
export class ClaimDetailV2ResponseDto {
|
||||
@ApiProperty()
|
||||
@@ -64,8 +65,11 @@ export class ClaimDetailV2ResponseDto {
|
||||
@ApiPropertyOptional({ description: 'Blame request number', example: 'BL12345' })
|
||||
blameRequestNo?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: 'Selected outer damaged parts' })
|
||||
selectedParts?: string[];
|
||||
@ApiPropertyOptional({
|
||||
description: 'Selected outer damaged parts (id, name, side, label_fa)',
|
||||
type: [DamageSelectedPartV2BodyDto],
|
||||
})
|
||||
selectedParts?: DamageSelectedPartV2BodyDto[];
|
||||
|
||||
@ApiPropertyOptional({ description: 'Selected other damaged parts' })
|
||||
otherParts?: string[];
|
||||
@@ -81,8 +85,32 @@ export class ClaimDetailV2ResponseDto {
|
||||
@ApiPropertyOptional({ description: 'Car angles captured' })
|
||||
carAngles?: Record<string, { captured: boolean; url?: string }>;
|
||||
|
||||
@ApiPropertyOptional({ description: 'Damaged parts captured' })
|
||||
damagedParts?: Record<string, { captured: boolean; url?: string }>;
|
||||
@ApiPropertyOptional({
|
||||
description:
|
||||
'Per-part captures (array index matches selectedParts; includes id, name, side, label_fa, captured, url)',
|
||||
type: 'array',
|
||||
items: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
index: { type: 'number' },
|
||||
id: { type: 'number', nullable: true },
|
||||
name: { type: 'string' },
|
||||
side: { type: 'string' },
|
||||
label_fa: { type: 'string' },
|
||||
captured: { type: 'boolean' },
|
||||
url: { type: 'string' },
|
||||
},
|
||||
},
|
||||
})
|
||||
damagedParts?: Array<{
|
||||
index: number;
|
||||
id?: number | null;
|
||||
name: string;
|
||||
side: string;
|
||||
label_fa: string;
|
||||
captured: boolean;
|
||||
url?: string;
|
||||
}>;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
description:
|
||||
|
||||
@@ -7,20 +7,57 @@ import {
|
||||
IsOptional,
|
||||
ValidateNested,
|
||||
IsEnum,
|
||||
IsInt,
|
||||
} from 'class-validator';
|
||||
import { Type } from 'class-transformer';
|
||||
import { ClaimRequiredDocumentType } from 'src/Types&Enums/claim-request-management/required-document-type.enum';
|
||||
import { DamagedPartItem } from 'src/claim-request-management/dto/capture-requirements-v2.dto';
|
||||
import { DaghiOption } from 'src/Types&Enums/claim-request-management/daghi-option.enum';
|
||||
|
||||
export class CarPartDamageV2Dto {
|
||||
@ApiProperty({ example: 'left' })
|
||||
@IsString()
|
||||
side: string;
|
||||
/**
|
||||
* Damage line part reference — same unified shape as `damage.selectedParts` / catalog rows.
|
||||
* Send either `{ name, side, label_fa?, id?, catalogKey? }` or legacy `{ part, side }`
|
||||
* (e.g. part `backFender`, side `left`); the API persists canonical `{ id, name, side, label_fa, catalogKey? }`.
|
||||
*/
|
||||
export class ExpertReplyCarPartDamageV2Dto {
|
||||
@ApiPropertyOptional({ description: 'Catalog id when known' })
|
||||
@IsOptional()
|
||||
@IsInt()
|
||||
id?: number;
|
||||
|
||||
@ApiProperty({ example: 'front_door' })
|
||||
@ApiPropertyOptional({
|
||||
description: 'Side-agnostic catalog segment, e.g. backfender',
|
||||
example: 'backfender',
|
||||
})
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
part: string;
|
||||
name?: string;
|
||||
|
||||
@ApiPropertyOptional({ example: 'left' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
side?: string;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
description:
|
||||
'Farsi label; optional when server can resolve from catalog + vehicle.carType',
|
||||
})
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
label_fa?: string;
|
||||
|
||||
@ApiPropertyOptional({ example: 'left_backfender' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
catalogKey?: string;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
description: 'Legacy expert UI: camelCase segment with `side`, e.g. backFender',
|
||||
example: 'backFender',
|
||||
})
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
part?: string;
|
||||
}
|
||||
|
||||
/** Same shape as V1 {@link PartsList} `daghi` (damage expert reply). */
|
||||
@@ -54,10 +91,10 @@ export class PartPricingV2Dto {
|
||||
@IsNotEmpty()
|
||||
partId: string;
|
||||
|
||||
@ApiProperty({ type: CarPartDamageV2Dto })
|
||||
@ApiProperty({ type: ExpertReplyCarPartDamageV2Dto })
|
||||
@ValidateNested()
|
||||
@Type(() => CarPartDamageV2Dto)
|
||||
carPartDamage: CarPartDamageV2Dto;
|
||||
@Type(() => ExpertReplyCarPartDamageV2Dto)
|
||||
carPartDamage: ExpertReplyCarPartDamageV2Dto;
|
||||
|
||||
@ApiProperty({ example: 'Minor' })
|
||||
@IsString()
|
||||
|
||||
@@ -1,25 +1,20 @@
|
||||
import { ApiProperty } from "@nestjs/swagger";
|
||||
import {
|
||||
ArrayMinSize,
|
||||
ArrayUnique,
|
||||
IsArray,
|
||||
IsEnum,
|
||||
IsNotEmpty,
|
||||
ValidateNested,
|
||||
} from "class-validator";
|
||||
import { OuterCarPart } from "src/claim-request-management/dto/select-outer-parts-v2.dto";
|
||||
import { Type } from "class-transformer";
|
||||
import { DamageSelectedPartV2BodyDto } from "src/claim-request-management/dto/damage-selected-part-v2.dto";
|
||||
|
||||
export class UpdateClaimDamagedPartsV2Dto {
|
||||
@ApiProperty({
|
||||
description: "Updated list of selected damaged outer parts",
|
||||
enum: OuterCarPart,
|
||||
isArray: true,
|
||||
example: ["hood", "front_bumper", "front_left_fender"],
|
||||
type: [DamageSelectedPartV2BodyDto],
|
||||
description: "Full replacement list of selected damaged outer parts (id, name, side, label_fa)",
|
||||
})
|
||||
@IsNotEmpty()
|
||||
@IsArray()
|
||||
@ArrayMinSize(1)
|
||||
@ArrayUnique()
|
||||
@IsEnum(OuterCarPart, { each: true })
|
||||
selectedParts: OuterCarPart[];
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => DamageSelectedPartV2BodyDto)
|
||||
selectedParts: DamageSelectedPartV2BodyDto[];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user