forked from Yara724/api
117 lines
2.9 KiB
TypeScript
117 lines
2.9 KiB
TypeScript
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
|
|
import { IsEnum, IsNotEmpty, IsString } from "class-validator";
|
|
|
|
/**
|
|
* V2 DTO for capturing car angle or damaged part
|
|
*/
|
|
export class CapturePartV2Dto {
|
|
@ApiProperty({
|
|
description: "Type of capture: angle or part",
|
|
example: "angle",
|
|
enum: ["angle", "part"],
|
|
})
|
|
@IsNotEmpty({ message: "Capture type is required" })
|
|
@IsEnum(["angle", "part"], {
|
|
message: 'Capture type must be either "angle" or "part"',
|
|
})
|
|
captureType: "angle" | "part";
|
|
|
|
@ApiProperty({
|
|
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" })
|
|
@IsString({ message: "Capture key must be a string" })
|
|
captureKey: string;
|
|
|
|
@ApiProperty({
|
|
type: "string",
|
|
format: "binary",
|
|
description: "Image file (JPG, PNG)",
|
|
})
|
|
file: Express.Multer.File;
|
|
}
|
|
|
|
/**
|
|
* Response DTO for capture part V2
|
|
*/
|
|
export class CapturePartV2ResponseDto {
|
|
@ApiProperty({
|
|
description: "Claim request ID",
|
|
example: "507f1f77bcf86cd799439011",
|
|
})
|
|
claimRequestId: string;
|
|
|
|
@ApiProperty({
|
|
description: "Type of capture",
|
|
example: "angle",
|
|
})
|
|
captureType: string;
|
|
|
|
@ApiProperty({
|
|
description: "Key of what was captured",
|
|
example: "front",
|
|
})
|
|
captureKey: string;
|
|
|
|
@ApiProperty({
|
|
description: "File URL",
|
|
example: "http://localhost:3000/files/captures/front-1234567890.jpg",
|
|
})
|
|
fileUrl: string;
|
|
|
|
@ApiProperty({
|
|
description: "Whether all captures are now complete",
|
|
example: false,
|
|
})
|
|
allCapturesComplete: boolean;
|
|
|
|
@ApiProperty({
|
|
description: "Current workflow step",
|
|
example: "CAPTURE_PART_DAMAGES",
|
|
})
|
|
currentStep: string;
|
|
|
|
@ApiProperty({
|
|
description: "Success message",
|
|
example: "Angle captured successfully. 6 captures remaining.",
|
|
})
|
|
message: string;
|
|
|
|
@ApiPropertyOptional({
|
|
description:
|
|
"True when expert-requested part resends are complete and the claim returned to the expert queue.",
|
|
})
|
|
expertResendComplete?: boolean;
|
|
|
|
@ApiPropertyOptional({
|
|
description:
|
|
"Best-effort Fanavaran attachment upload result. Local capture still succeeds when this contains a warning.",
|
|
})
|
|
fanavaranAttachment?: unknown;
|
|
}
|
|
|
|
/**
|
|
* Response DTO for car walk-around video upload (V2)
|
|
*/
|
|
export class VideoCaptureV2ResponseDto {
|
|
@ApiProperty({
|
|
description: "Claim case ID",
|
|
example: "507f1f77bcf86cd799439011",
|
|
})
|
|
claimRequestId: string;
|
|
|
|
@ApiProperty({
|
|
description: "ID of the stored video document (claim-video-capture)",
|
|
example: "507f1f77bcf86cd799439012",
|
|
})
|
|
videoId: string;
|
|
|
|
@ApiProperty({
|
|
description: "Success message",
|
|
example: "Video capture uploaded successfully.",
|
|
})
|
|
message: string;
|
|
}
|