Better error handling and validation and min/max prices added for expert submit

This commit is contained in:
SepehrYahyaee
2026-09-08 13:11:24 +03:30
parent eb6cef1127
commit 0e861ff6d1
9 changed files with 485 additions and 45 deletions

View File

@@ -27,7 +27,7 @@ export class DaghiDetailsV2Dto {
option: DaghiOption;
@ApiPropertyOptional({
description: `Required when option is '${DaghiOption.RECYCLED_PARTS_VALUE}' (Toman)`,
description: `Required when option is '${DaghiOption.RECYCLED_PARTS_VALUE}' (Toman; 100,000 to 10,000,000,000).`,
})
@ValidateIf(
(daghi: DaghiDetailsV2Dto) =>
@@ -63,7 +63,8 @@ export class PartPricingV2Dto {
@ApiPropertyOptional({
example: "5000000",
description: "Required for change lines; omitted for repair lines. Use 0 if unused.",
description:
"Required for change lines; omitted for repair lines. Every supplied amount must be between 100,000 and 10,000,000,000 Toman.",
})
@ValidateIf(
(part: PartPricingV2Dto) =>
@@ -78,7 +79,8 @@ export class PartPricingV2Dto {
@ApiProperty({
example: "2000000",
description: "Labor in Toman (integer string). Use 0 if the full amount is in price.",
description:
"Labor in Toman (integer string; 100,000 to 10,000,000,000).",
})
@IsString()
@IsNotEmpty()
@@ -87,7 +89,8 @@ export class PartPricingV2Dto {
@ApiProperty({
example: "7000000",
description: "Line total in Toman (integer string).",
description:
"Line total in Toman (integer string; 100,000 to 10,000,000,000).",
})
@IsString()
@IsNotEmpty()
@@ -116,10 +119,13 @@ export class PartPricingV2Dto {
}
export class SubmitExpertReplyV2Dto {
@ApiProperty({ example: 'Front door and hood have severe paint damage' })
@ApiPropertyOptional({
example: 'Front door and hood have severe paint damage',
description: "Optional expert note about the damage assessment.",
})
@IsOptional()
@IsString()
@IsNotEmpty()
description: string;
description?: string;
@ApiProperty({
type: [PartPricingV2Dto],