forked from Yara724/api
blame and claim refactored
This commit is contained in:
@@ -0,0 +1,96 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsArray, IsEnum, IsNotEmpty, ArrayMinSize, ArrayUnique } from 'class-validator';
|
||||
|
||||
/**
|
||||
* Enum for valid outer car parts that can be damaged
|
||||
* Follows the naming convention from workflow step definition
|
||||
*/
|
||||
export enum OuterCarPart {
|
||||
// Hood
|
||||
HOOD = 'hood',
|
||||
|
||||
// Doors
|
||||
FRONT_RIGHT_DOOR = 'front_right_door',
|
||||
FRONT_LEFT_DOOR = 'front_left_door',
|
||||
REAR_RIGHT_DOOR = 'rear_right_door',
|
||||
REAR_LEFT_DOOR = 'rear_left_door',
|
||||
|
||||
// Bumpers
|
||||
FRONT_BUMPER = 'front_bumper',
|
||||
REAR_BUMPER = 'rear_bumper',
|
||||
|
||||
// Fenders
|
||||
FRONT_RIGHT_FENDER = 'front_right_fender',
|
||||
FRONT_LEFT_FENDER = 'front_left_fender',
|
||||
REAR_RIGHT_FENDER = 'rear_right_fender',
|
||||
REAR_LEFT_FENDER = 'rear_left_fender',
|
||||
|
||||
// Trunk & Roof
|
||||
TRUNK = 'trunk',
|
||||
ROOF = 'roof',
|
||||
}
|
||||
|
||||
/**
|
||||
* V2 DTO for selecting damaged outer car parts
|
||||
* Much cleaner than the nested boolean structure
|
||||
*/
|
||||
export class SelectOuterPartsV2Dto {
|
||||
@ApiProperty({
|
||||
description: 'Array of selected damaged outer car parts',
|
||||
example: ['hood', 'front_right_door', 'rear_bumper', 'roof'],
|
||||
enum: OuterCarPart,
|
||||
isArray: true,
|
||||
minItems: 1,
|
||||
maxItems: 13,
|
||||
})
|
||||
@IsNotEmpty({ message: 'Selected parts array cannot be empty' })
|
||||
@IsArray({ message: 'selectedParts must be an array' })
|
||||
@ArrayMinSize(1, { message: 'At least one damaged part must be selected' })
|
||||
@ArrayUnique({ message: 'Duplicate parts are not allowed' })
|
||||
@IsEnum(OuterCarPart, {
|
||||
each: true,
|
||||
message: 'Invalid part name. Must be one of the valid outer car parts',
|
||||
})
|
||||
selectedParts: OuterCarPart[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Response DTO for select outer parts V2
|
||||
*/
|
||||
export class SelectOuterPartsV2ResponseDto {
|
||||
@ApiProperty({
|
||||
description: 'Claim request ID',
|
||||
example: '507f1f77bcf86cd799439011',
|
||||
})
|
||||
claimRequestId: string;
|
||||
|
||||
@ApiProperty({
|
||||
description: 'Public ID shared across blame and claim',
|
||||
example: 'A14235',
|
||||
})
|
||||
publicId: string;
|
||||
|
||||
@ApiProperty({
|
||||
description: 'Array of selected damaged parts',
|
||||
example: ['hood', 'front_right_door', 'rear_bumper'],
|
||||
})
|
||||
selectedParts: string[];
|
||||
|
||||
@ApiProperty({
|
||||
description: 'Current workflow step',
|
||||
example: 'SELECT_OUTER_PARTS',
|
||||
})
|
||||
currentStep: string;
|
||||
|
||||
@ApiProperty({
|
||||
description: 'Next possible workflow step',
|
||||
example: 'SELECT_OTHER_PARTS',
|
||||
})
|
||||
nextStep: string;
|
||||
|
||||
@ApiProperty({
|
||||
description: 'Success message',
|
||||
example: 'Outer parts selected successfully. Please proceed to select other parts.',
|
||||
})
|
||||
message: string;
|
||||
}
|
||||
Reference in New Issue
Block a user