Implement role-complete inquiry participants

This commit is contained in:
SepehrYahyaee
2026-09-13 10:59:00 +03:30
parent 401ad6a143
commit c64f23091a
12 changed files with 2179 additions and 690 deletions

View File

@@ -1,5 +1,11 @@
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
import { IsNotEmpty, IsOptional, IsString, MaxLength } from "class-validator";
import {
IsNotEmpty,
IsOptional,
IsString,
MaxLength,
ValidateIf,
} from "class-validator";
import { Types } from "mongoose";
import { AddPlateDto } from "src/profile/dto/user/AddPlateDto";
import { StepsEnum } from "src/Types&Enums/blame-request-management/steps.enum";
@@ -10,6 +16,7 @@ import {
} from "src/Types&Enums/blame-request-management/accident-conditions.enum";
import { BlameRequestType } from "src/Types&Enums/blame-request-management/blameRequestType.enum";
import { IsEnum } from "class-validator";
import { InquiryParticipantFieldsDto } from "./inquiry-participants.dto";
export class InitialFormDto {
@ApiProperty({ required: false, default: false })
@@ -227,10 +234,10 @@ export class BlameConfessionDtoV2 {
* All identity and license fields from {@link AddPlateDto} are preserved; only
* `plate` is replaced by `vin` (the 17-character chassis / VIN string).
*/
export class InitialFormVinDto {
@ApiProperty({
export class InitialFormVinDto extends InquiryParticipantFieldsDto {
@ApiPropertyOptional({
type: String,
required: true,
required: false,
description: "17-character VIN / chassis number (شماره شاسی)",
example: "NAAM01E15HK123456",
maxLength: 17,
@@ -238,30 +245,49 @@ export class InitialFormVinDto {
@IsString()
@IsNotEmpty()
@MaxLength(17)
@ValidateIf((dto) => !dto.vehicle?.vin)
vin: string;
@ApiProperty({ type: String, required: true })
@ApiPropertyOptional({
type: String,
description: "Legacy third-party policyholder national code",
})
@ValidateIf((dto) => !dto.thirdPartyPolicyholder)
nationalCodeOfInsurer: string;
@ApiProperty({ type: String, required: true })
@ApiPropertyOptional({
type: String,
description: "Legacy driver national code",
})
@ValidateIf((dto) => !dto.driver)
nationalCodeOfDriver: string;
@ApiProperty({ type: String, required: true })
@ApiPropertyOptional({ type: String })
insurerLicense: string;
@ApiProperty({ type: String, required: true })
@ApiPropertyOptional({ type: String })
driverLicense: string;
@ApiProperty({ type: Boolean, required: true })
@ApiPropertyOptional({
type: Boolean,
description: "Legacy role relationship",
})
@ValidateIf((dto) => !dto.driver)
driverIsInsurer: boolean;
@ApiProperty({ type: Boolean, required: true, default: false })
@ApiPropertyOptional({ type: Boolean, default: false })
isNewCar: boolean;
@ApiProperty({ type: Boolean, required: true })
@ApiPropertyOptional({
type: Boolean,
description: "Legacy; use driver.hasDrivingLicense",
})
userNoCertificate: boolean;
@ApiProperty({ type: Number, required: true })
@ApiPropertyOptional({
type: Number,
description: "Legacy policyholder birthday",
})
insurerBirthday: number;
@ApiPropertyOptional({ type: String, required: false })