forked from Yara724/api
Require structured inquiry participant inputs
This commit is contained in:
@@ -1,11 +1,5 @@
|
||||
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
|
||||
import {
|
||||
IsNotEmpty,
|
||||
IsOptional,
|
||||
IsString,
|
||||
MaxLength,
|
||||
ValidateIf,
|
||||
} from "class-validator";
|
||||
import { IsNotEmpty, IsOptional, IsString } 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";
|
||||
@@ -229,70 +223,8 @@ export class BlameConfessionDtoV2 {
|
||||
imGuilty?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* V2 initial-form step submitted with a VIN/chassis number instead of a plate.
|
||||
* 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 extends InquiryParticipantFieldsDto {
|
||||
@ApiPropertyOptional({
|
||||
type: String,
|
||||
required: false,
|
||||
description: "17-character VIN / chassis number (شماره شاسی)",
|
||||
example: "NAAM01E15HK123456",
|
||||
maxLength: 17,
|
||||
})
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
@MaxLength(17)
|
||||
@ValidateIf((dto) => !dto.vehicle?.vin)
|
||||
vin: string;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
type: String,
|
||||
description: "Legacy third-party policyholder national code",
|
||||
})
|
||||
@ValidateIf((dto) => !dto.thirdPartyPolicyholder)
|
||||
nationalCodeOfInsurer: string;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
type: String,
|
||||
description: "Legacy driver national code",
|
||||
})
|
||||
@ValidateIf((dto) => !dto.driver)
|
||||
nationalCodeOfDriver: string;
|
||||
|
||||
@ApiPropertyOptional({ type: String })
|
||||
insurerLicense: string;
|
||||
|
||||
@ApiPropertyOptional({ type: String })
|
||||
driverLicense: string;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
type: Boolean,
|
||||
description: "Legacy role relationship",
|
||||
})
|
||||
@ValidateIf((dto) => !dto.driver)
|
||||
driverIsInsurer: boolean;
|
||||
|
||||
@ApiPropertyOptional({ type: Boolean, default: false })
|
||||
isNewCar: boolean;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
type: Boolean,
|
||||
description: "Legacy; use driver.hasDrivingLicense",
|
||||
})
|
||||
userNoCertificate: boolean;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
type: Number,
|
||||
description: "Legacy policyholder birthday",
|
||||
})
|
||||
insurerBirthday: number;
|
||||
|
||||
@ApiPropertyOptional({ type: String, required: false })
|
||||
driverBirthday: string | null;
|
||||
}
|
||||
/** V2 initial-form step submitted with the shared structured vehicle contract. */
|
||||
export class InitialFormVinDto extends InquiryParticipantFieldsDto {}
|
||||
|
||||
// export class DocsOfThisFile {
|
||||
// @ApiProperty()
|
||||
|
||||
@@ -1,182 +1,14 @@
|
||||
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
|
||||
import {
|
||||
IsBoolean,
|
||||
IsNotEmpty,
|
||||
IsOptional,
|
||||
IsString,
|
||||
MaxLength,
|
||||
ValidateIf,
|
||||
ValidateNested,
|
||||
} from "class-validator";
|
||||
import { Type } from "class-transformer";
|
||||
import { InquiryParticipantFieldsDto } from "src/common/dto/inquiry-participants.dto";
|
||||
|
||||
class PlateV6Dto {
|
||||
@ApiProperty({ example: "44", description: "Left two digits" })
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
leftDigits: string;
|
||||
|
||||
@ApiProperty({ example: "ب", description: "Center alphabet letter" })
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
centerAlphabet: string;
|
||||
|
||||
@ApiProperty({ example: "111", description: "Center three digits" })
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
centerDigits: string;
|
||||
|
||||
@ApiProperty({
|
||||
example: "22",
|
||||
description: "Right two digits (Iran region code)",
|
||||
})
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
ir: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Inquiry body for the V6 call-center flow.
|
||||
* Same as V3 but without `sheba` — the user adds their own IBAN later via the link.
|
||||
*/
|
||||
export class RunCallCenterInquiryV6Dto extends InquiryParticipantFieldsDto {
|
||||
@ApiPropertyOptional({
|
||||
type: PlateV6Dto,
|
||||
description: "Plate segments — Tejarat block / third-party inquiry.",
|
||||
})
|
||||
@ValidateNested()
|
||||
@Type(() => PlateV6Dto)
|
||||
@ValidateIf((dto) => !dto.vehicle?.currentPlate)
|
||||
plate: PlateV6Dto;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
example: "1234567890",
|
||||
description: "Legacy third-party policyholder national code",
|
||||
})
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
@ValidateIf((dto) => !dto.thirdPartyPolicyholder)
|
||||
nationalCodeOfInsurer: string;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
example: "1234567890",
|
||||
description: "Legacy driver national code",
|
||||
})
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
@ValidateIf((dto) => !dto.driver)
|
||||
nationalCodeOfDriver: string;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
example: true,
|
||||
description: "Legacy role relationship",
|
||||
})
|
||||
@IsBoolean()
|
||||
@ValidateIf((dto) => !dto.driver)
|
||||
driverIsInsurer: boolean;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
example: 13780624,
|
||||
description: "Legacy policyholder birth date (Jalali)",
|
||||
})
|
||||
insurerBirthday: number | string;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
example: 13780624,
|
||||
description:
|
||||
"Driver birth date (Jalali). Required when driverIsInsurer is false.",
|
||||
})
|
||||
@IsOptional()
|
||||
driverBirthday?: number | string | null;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
example: "123456789",
|
||||
description: "Driver license (required when driverIsInsurer is false).",
|
||||
})
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
driverLicense?: string;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
example: "123456789",
|
||||
description: "Insurer license (required when driverIsInsurer is true).",
|
||||
})
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
insurerLicense?: string;
|
||||
}
|
||||
export class RunCallCenterInquiryV6Dto extends InquiryParticipantFieldsDto {}
|
||||
|
||||
/**
|
||||
* VIN / chassis variant of the V6 call-center inquiry.
|
||||
* Identical to `RunCallCenterInquiryV6Dto` but replaces `plate` with `vin`.
|
||||
* Sheba (IBAN) is intentionally absent — the user provides it themselves via the link.
|
||||
*/
|
||||
export class RunCallCenterInquiryVinV6Dto extends InquiryParticipantFieldsDto {
|
||||
@ApiPropertyOptional({
|
||||
example: "NAAM01E15HK123456",
|
||||
description: "17-character VIN / chassis number (شماره شاسی)",
|
||||
maxLength: 17,
|
||||
})
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
@MaxLength(17)
|
||||
@ValidateIf((dto) => !dto.vehicle?.vin)
|
||||
vin: string;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
example: "1234567890",
|
||||
description: "Legacy third-party policyholder national code",
|
||||
})
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
@ValidateIf((dto) => !dto.thirdPartyPolicyholder)
|
||||
nationalCodeOfInsurer: string;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
example: "1234567890",
|
||||
description: "Legacy driver national code",
|
||||
})
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
@ValidateIf((dto) => !dto.driver)
|
||||
nationalCodeOfDriver: string;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
example: true,
|
||||
description: "Legacy role relationship",
|
||||
})
|
||||
@IsBoolean()
|
||||
@ValidateIf((dto) => !dto.driver)
|
||||
driverIsInsurer: boolean;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
example: 13780624,
|
||||
description: "Legacy policyholder birth date (Jalali)",
|
||||
})
|
||||
insurerBirthday: number | string;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
example: 13780624,
|
||||
description:
|
||||
"Driver birth date (Jalali). Required when driverIsInsurer is false.",
|
||||
})
|
||||
@IsOptional()
|
||||
driverBirthday?: number | string | null;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
example: "123456789",
|
||||
description: "Driver license (required when driverIsInsurer is false).",
|
||||
})
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
driverLicense?: string;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
example: "123456789",
|
||||
description: "Insurer license (required when driverIsInsurer is true).",
|
||||
})
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
insurerLicense?: string;
|
||||
}
|
||||
export class RunCallCenterInquiryVinV6Dto extends InquiryParticipantFieldsDto {}
|
||||
|
||||
@@ -1,95 +1,12 @@
|
||||
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
|
||||
import {
|
||||
IsBoolean,
|
||||
IsNotEmpty,
|
||||
IsOptional,
|
||||
IsString,
|
||||
MaxLength,
|
||||
ValidateIf,
|
||||
ValidateNested,
|
||||
} from "class-validator";
|
||||
import { Type } from "class-transformer";
|
||||
import { ApiPropertyOptional } from "@nestjs/swagger";
|
||||
import { IsOptional, IsString } from "class-validator";
|
||||
import { InquiryParticipantFieldsDto } from "src/common/dto/inquiry-participants.dto";
|
||||
|
||||
class PlateV3Dto {
|
||||
@ApiProperty({ example: "44", description: "Left two digits" })
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
leftDigits: string;
|
||||
|
||||
@ApiProperty({ example: "ب", description: "Center alphabet letter" })
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
centerAlphabet: string;
|
||||
|
||||
@ApiProperty({ example: "111", description: "Center three digits" })
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
centerDigits: string;
|
||||
|
||||
@ApiProperty({
|
||||
example: "22",
|
||||
description: "Right two digits (Iran region code)",
|
||||
})
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
ir: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Body for `POST run-inquiries/:requestId`.
|
||||
* First call = guilty party (+ auto claim). Second call = damaged party (THIRD_PARTY only).
|
||||
*/
|
||||
export class RunInquiriesV3Dto extends InquiryParticipantFieldsDto {
|
||||
@ApiPropertyOptional({
|
||||
type: PlateV3Dto,
|
||||
description: "Plate segments — Tejarat block / third-party inquiry.",
|
||||
})
|
||||
@ValidateNested()
|
||||
@Type(() => PlateV3Dto)
|
||||
@ValidateIf((dto) => !dto.vehicle?.currentPlate)
|
||||
plate: PlateV3Dto;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
example: "1234567890",
|
||||
description: "Legacy third-party policyholder national code",
|
||||
})
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
@ValidateIf((dto) => !dto.thirdPartyPolicyholder)
|
||||
nationalCodeOfInsurer: string;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
example: "1234567890",
|
||||
description: "Legacy driver national code",
|
||||
})
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
@ValidateIf((dto) => !dto.driver)
|
||||
nationalCodeOfDriver: string;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
example: true,
|
||||
description: "Legacy role relationship",
|
||||
})
|
||||
@IsBoolean()
|
||||
@ValidateIf((dto) => !dto.driver)
|
||||
driverIsInsurer: boolean;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
example: 13780624,
|
||||
description: "Legacy policyholder birth date (Jalali)",
|
||||
})
|
||||
insurerBirthday: number | string;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
example: 13780624,
|
||||
description:
|
||||
"Driver birth date (Jalali). Required when driverIsInsurer is false.",
|
||||
})
|
||||
@IsOptional()
|
||||
driverBirthday?: number | string | null;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
example: "IR123456789012345678901234",
|
||||
description:
|
||||
@@ -98,32 +15,6 @@ export class RunInquiriesV3Dto extends InquiryParticipantFieldsDto {
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
sheba?: string;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
example: "123456789",
|
||||
description: "Driver license (required when driverIsInsurer is false).",
|
||||
})
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
driverLicense?: string;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
example: "123456789",
|
||||
description: "Insurer license (required when driverIsInsurer is true).",
|
||||
})
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
insurerLicense?: string;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
example: "1",
|
||||
description:
|
||||
"Driving licence type code from GET /lookups/driving-licence-types. " +
|
||||
"Optional — used in V4 FileMaker flow.",
|
||||
})
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
licenseType?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -132,57 +23,6 @@ export class RunInquiriesV3Dto extends InquiryParticipantFieldsDto {
|
||||
* First call = guilty party (+ auto claim). Second call = damaged party (THIRD_PARTY only).
|
||||
*/
|
||||
export class RunInquiriesVinV3Dto extends InquiryParticipantFieldsDto {
|
||||
@ApiPropertyOptional({
|
||||
example: "NAAM01E15HK123456",
|
||||
description: "17-character VIN / chassis number (شماره شاسی)",
|
||||
maxLength: 17,
|
||||
})
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
@MaxLength(17)
|
||||
@ValidateIf((dto) => !dto.vehicle?.vin)
|
||||
vin: string;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
example: "1234567890",
|
||||
description: "Legacy third-party policyholder national code",
|
||||
})
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
@ValidateIf((dto) => !dto.thirdPartyPolicyholder)
|
||||
nationalCodeOfInsurer: string;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
example: "1234567890",
|
||||
description: "Legacy driver national code",
|
||||
})
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
@ValidateIf((dto) => !dto.driver)
|
||||
nationalCodeOfDriver: string;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
example: true,
|
||||
description: "Legacy role relationship",
|
||||
})
|
||||
@IsBoolean()
|
||||
@ValidateIf((dto) => !dto.driver)
|
||||
driverIsInsurer: boolean;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
example: 13780624,
|
||||
description: "Legacy policyholder birth date (Jalali)",
|
||||
})
|
||||
insurerBirthday: number | string;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
example: 13780624,
|
||||
description:
|
||||
"Driver birth date (Jalali). Required when driverIsInsurer is false.",
|
||||
})
|
||||
@IsOptional()
|
||||
driverBirthday?: number | string | null;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
example: "IR123456789012345678901234",
|
||||
description:
|
||||
@@ -191,30 +31,4 @@ export class RunInquiriesVinV3Dto extends InquiryParticipantFieldsDto {
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
sheba?: string;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
example: "123456789",
|
||||
description: "Driver license (required when driverIsInsurer is false).",
|
||||
})
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
driverLicense?: string;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
example: "123456789",
|
||||
description: "Insurer license (required when driverIsInsurer is true).",
|
||||
})
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
insurerLicense?: string;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
example: "1",
|
||||
description:
|
||||
"Driving licence type code from GET /lookups/driving-licence-types. " +
|
||||
"Optional — used in V4 FileMaker flow.",
|
||||
})
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
licenseType?: string;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user