Validation for prices and objection

This commit is contained in:
SepehrYahyaee
2026-05-20 11:08:47 +03:30
parent 511d478064
commit e4dfe7c572
18 changed files with 467 additions and 60 deletions

View File

@@ -8,6 +8,7 @@ import {
IsString,
ValidateNested,
} from "class-validator";
import { IsRepairLineAmountToman } from "src/common/validators/repair-line-amount-toman.validator";
import { FactorStatus } from "src/Types&Enums/claim-request-management/factor-status.enum";
class FactorDecisionDto {
@@ -50,26 +51,29 @@ class FactorDecisionV2Dto {
@ApiPropertyOptional({
description:
"Part price (Persian/ASCII digits). For each factor line, send totalPayment **or** both price and salary. Required for **APPROVED** (accepted amount read from factor / expert) and **REJECTED** (expert’s replacement pricing).",
"Part price (Toman). With totalPayment or price+salary for APPROVED/REJECTED factor lines. Use 0 if unused.",
})
@IsOptional()
@IsString()
@IsRepairLineAmountToman({ allowZero: true })
price?: string;
@ApiPropertyOptional({
description:
"Salary portion when not using a single totalPayment (must be sent together with price for APPROVED/REJECTED factor lines).",
"Salary in Toman. Send with price when not using only totalPayment. Use 0 if unused.",
})
@IsOptional()
@IsString()
@IsRepairLineAmountToman({ allowZero: true })
salary?: string;
@ApiPropertyOptional({
description:
"Line total payment; preferred when the expert enters one number. Required together with APPROVED/REJECTED unless both price and salary are sent.",
"Line total in Toman; or send both price and salary.",
})
@IsOptional()
@IsString()
@IsRepairLineAmountToman()
totalPayment?: string;
}