forked from Yara724/api
merge upstream
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||
import { IsEnum, IsNotEmpty, IsString } from 'class-validator';
|
||||
import { CarAngle } from 'src/Types&Enums/claim-request-management/required-document-type.enum';
|
||||
|
||||
/**
|
||||
* V2 DTO for capturing car angle or damaged part
|
||||
@@ -18,7 +17,8 @@ export class CapturePartV2Dto {
|
||||
captureType: 'angle' | 'part';
|
||||
|
||||
@ApiProperty({
|
||||
description: 'Key of the angle or part being captured',
|
||||
description:
|
||||
'When captureType is angle: front | back | left | right. When part: catalog id as string (e.g. "101"), 0-based index (e.g. "0"), or full catalog key (e.g. left_backfender). Prefer id or index for parts.',
|
||||
example: 'front',
|
||||
})
|
||||
@IsNotEmpty({ message: 'Capture key is required' })
|
||||
|
||||
@@ -72,10 +72,17 @@ export class CarAngleItem {
|
||||
*/
|
||||
export class DamagedPartItem {
|
||||
@ApiProperty({
|
||||
description: 'Part key',
|
||||
example: 'hood',
|
||||
description:
|
||||
'Side-agnostic part name (matches catalog suffix); use with `side` to disambiguate',
|
||||
example: 'backfender',
|
||||
})
|
||||
key: string;
|
||||
name: string;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
description: 'Vehicle side / region (left, right, front, back, top)',
|
||||
example: 'left',
|
||||
})
|
||||
side?: string;
|
||||
|
||||
@ApiProperty({
|
||||
description: 'Display label in Farsi',
|
||||
@@ -83,6 +90,12 @@ export class DamagedPartItem {
|
||||
})
|
||||
label_fa: string;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
description: 'Deprecated: same as `name` (kept for older clients)',
|
||||
example: 'backfender',
|
||||
})
|
||||
key?: string;
|
||||
|
||||
@ApiProperty({
|
||||
description: 'Display label in English',
|
||||
example: 'Hood',
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||
import { DamageSelectedPartV2BodyDto } from './damage-selected-part-v2.dto';
|
||||
|
||||
/** Suggested HTTP call for the owner UI (`pathTemplate`: replace placeholders). */
|
||||
export class ClaimDetailsOwnerNextActionV2Dto {
|
||||
@@ -123,8 +124,11 @@ export class ClaimDetailsV2ResponseDto {
|
||||
plate?: any;
|
||||
};
|
||||
|
||||
@ApiPropertyOptional({ description: 'Selected outer damaged parts' })
|
||||
selectedParts?: string[];
|
||||
@ApiPropertyOptional({
|
||||
description: 'Selected outer damaged parts (ordered objects with id, name, side, label_fa)',
|
||||
type: [DamageSelectedPartV2BodyDto],
|
||||
})
|
||||
selectedParts?: DamageSelectedPartV2BodyDto[];
|
||||
|
||||
@ApiPropertyOptional({ description: 'Selected other damaged parts' })
|
||||
otherParts?: string[];
|
||||
@@ -141,8 +145,36 @@ export class ClaimDetailsV2ResponseDto {
|
||||
@ApiPropertyOptional({ description: 'Car angles captured' })
|
||||
carAngles?: Record<string, { captured: boolean; url?: string }>;
|
||||
|
||||
@ApiPropertyOptional({ description: 'Damaged parts captured' })
|
||||
damagedParts?: Record<string, { label_fa: string; captured: boolean; url?: string }>;
|
||||
@ApiPropertyOptional({
|
||||
description:
|
||||
'Per-part capture status and URLs (array index aligns with selectedParts; includes id, name, side, label_fa)',
|
||||
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' },
|
||||
path: { type: 'string' },
|
||||
fileName: { type: 'string' },
|
||||
},
|
||||
},
|
||||
})
|
||||
damagedParts?: Array<{
|
||||
index: number;
|
||||
id?: number | null;
|
||||
name: string;
|
||||
side: string;
|
||||
label_fa: string;
|
||||
captured: boolean;
|
||||
url?: string;
|
||||
path?: string;
|
||||
fileName?: string;
|
||||
}>;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
description:
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
|
||||
import { IsInt, IsOptional, IsString } from "class-validator";
|
||||
|
||||
/** Stored shape / API payload for one selected outer damaged part (V2). */
|
||||
export class DamageSelectedPartV2BodyDto {
|
||||
@ApiPropertyOptional({ description: "Catalog id when from outer-parts catalog" })
|
||||
@IsOptional()
|
||||
@IsInt()
|
||||
id?: number;
|
||||
|
||||
@ApiProperty({ example: "backfender" })
|
||||
@IsString()
|
||||
name: string;
|
||||
|
||||
@ApiProperty({ example: "left" })
|
||||
@IsString()
|
||||
side: string;
|
||||
|
||||
@ApiProperty({ example: "گلگیر عقب" })
|
||||
@IsString()
|
||||
label_fa: string;
|
||||
|
||||
@ApiPropertyOptional({ description: "Original catalog key, e.g. left_backfender" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
catalogKey?: string;
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import {
|
||||
ClaimVehicleTypeV2,
|
||||
OuterPartSideV2,
|
||||
} from "src/static/outer-car-parts-catalog";
|
||||
import { DamageSelectedPartV2BodyDto } from "./damage-selected-part-v2.dto";
|
||||
|
||||
/**
|
||||
* Enum for valid outer car parts that can be damaged
|
||||
@@ -97,10 +98,11 @@ export class SelectOuterPartsV2ResponseDto {
|
||||
publicId: string;
|
||||
|
||||
@ApiProperty({
|
||||
description: 'Array of selected damaged parts',
|
||||
example: ['hood', 'front_right_door', 'rear_bumper'],
|
||||
description:
|
||||
"Ordered selected parts: id, side-agnostic name, side, label_fa (and optional catalogKey)",
|
||||
type: [DamageSelectedPartV2BodyDto],
|
||||
})
|
||||
selectedParts: string[];
|
||||
selectedParts: DamageSelectedPartV2BodyDto[];
|
||||
|
||||
@ApiProperty({
|
||||
description: 'Selected part IDs',
|
||||
|
||||
Reference in New Issue
Block a user