forked from Yara724/api
Fixed daqi being enforced on REPAIR
This commit is contained in:
@@ -43,4 +43,22 @@ describe("SubmitExpertReplyV2Dto", () => {
|
||||
|
||||
expect(await validate(dto)).toHaveLength(0);
|
||||
});
|
||||
|
||||
it("accepts a repair part without daghi", async () => {
|
||||
const dto = plainToInstance(SubmitExpertReplyV2Dto, {
|
||||
description: "Damage assessment",
|
||||
parts: [
|
||||
{
|
||||
partId: 201,
|
||||
typeOfDamage: TypeOfDamage.Repair,
|
||||
price: "10000",
|
||||
salary: "0",
|
||||
totalPayment: "10000",
|
||||
factorNeeded: false,
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
expect(await validate(dto)).toHaveLength(0);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -94,11 +94,17 @@ export class PartPricingV2Dto {
|
||||
@IsRepairLineAmountToman({ allowZero: true })
|
||||
totalPayment: string;
|
||||
|
||||
@ApiProperty({ type: DaghiDetailsV2Dto })
|
||||
@ApiPropertyOptional({
|
||||
type: DaghiDetailsV2Dto,
|
||||
description: "Required for change lines; omit for repair lines.",
|
||||
})
|
||||
@ValidateIf(
|
||||
(part: PartPricingV2Dto) => part.typeOfDamage === TypeOfDamage.Change,
|
||||
)
|
||||
@IsNotEmpty()
|
||||
@ValidateNested()
|
||||
@Type(() => DaghiDetailsV2Dto)
|
||||
daghi: DaghiDetailsV2Dto;
|
||||
daghi?: DaghiDetailsV2Dto;
|
||||
|
||||
@ApiProperty({
|
||||
example: false,
|
||||
|
||||
Reference in New Issue
Block a user