forked from Yara724/api
inquiry refresh service + fanavaran client config
This commit is contained in:
118
src/request-management/dto/reinquiry-inquiries.dto.ts
Normal file
118
src/request-management/dto/reinquiry-inquiries.dto.ts
Normal file
@@ -0,0 +1,118 @@
|
||||
import { ApiPropertyOptional } from "@nestjs/swagger";
|
||||
import { Type } from "class-transformer";
|
||||
import {
|
||||
IsArray,
|
||||
IsBoolean,
|
||||
IsEnum,
|
||||
IsInt,
|
||||
IsOptional,
|
||||
IsString,
|
||||
Min,
|
||||
} from "class-validator";
|
||||
import { PartyRole } from "../entities/schema/partyRole.enum";
|
||||
|
||||
export class ReinquiryInquiriesDto {
|
||||
@ApiPropertyOptional({
|
||||
description: "Blame public id (e.g. A00041). Use for single-case refresh.",
|
||||
example: "A00041",
|
||||
})
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
publicId?: string;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
description: "Blame case Mongo id. Alternative to publicId.",
|
||||
})
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
blameRequestId?: string;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
description: "Bulk mode: max number of blame cases to process (0 = no limit).",
|
||||
default: 0,
|
||||
})
|
||||
@IsOptional()
|
||||
@Type(() => Number)
|
||||
@IsInt()
|
||||
@Min(0)
|
||||
limit?: number;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
description: "Party roles to refresh. Defaults to FIRST and SECOND.",
|
||||
enum: PartyRole,
|
||||
isArray: true,
|
||||
})
|
||||
@IsOptional()
|
||||
@IsArray()
|
||||
@IsEnum(PartyRole, { each: true })
|
||||
roles?: PartyRole[];
|
||||
|
||||
@ApiPropertyOptional({
|
||||
description: "When true, runs inquiries but does not persist updates.",
|
||||
default: false,
|
||||
})
|
||||
@IsOptional()
|
||||
@IsBoolean()
|
||||
dryRun?: boolean;
|
||||
}
|
||||
|
||||
export class ReinquiryPartyInputDto {
|
||||
plateId?: string;
|
||||
plate?: {
|
||||
ir: number;
|
||||
leftDigits: number;
|
||||
centerAlphabet: string;
|
||||
centerDigits: number;
|
||||
};
|
||||
nationalCode?: string;
|
||||
birthDate?: number | string;
|
||||
}
|
||||
|
||||
export class ReinquiryPartyPreviewDto {
|
||||
/** What would be written to inquiries.thirdParty.data[role] */
|
||||
thirdParty?: Record<string, unknown>;
|
||||
/** What would be written to inquiries.person.data[role] */
|
||||
person?: Record<string, unknown>;
|
||||
/** Summary of parties[].vehicle / parties[].insurance updates */
|
||||
party?: {
|
||||
vehicle?: { name?: string; type?: string; plateId?: string };
|
||||
insurance?: {
|
||||
policyNumber?: string;
|
||||
company?: string;
|
||||
financialCeiling?: string;
|
||||
startDate?: string;
|
||||
endDate?: string;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
export class ReinquiryPartyResultDto {
|
||||
role: PartyRole;
|
||||
/** Values read from blameCase.parties[role] before calling external APIs */
|
||||
input?: ReinquiryPartyInputDto;
|
||||
/** Present when dryRun=true — shows what would be saved (not written to DB) */
|
||||
preview?: ReinquiryPartyPreviewDto;
|
||||
thirdParty?: { ok: boolean; message?: string };
|
||||
person?: { ok: boolean; message?: string };
|
||||
}
|
||||
|
||||
export class ReinquiryCaseResultDto {
|
||||
blameRequestId: string;
|
||||
publicId?: string;
|
||||
blameUpdated: boolean;
|
||||
claimsUpdated: number;
|
||||
/** Full inquiries object that would be saved (dryRun only) */
|
||||
inquiriesPreview?: {
|
||||
thirdParty?: Record<string, unknown>;
|
||||
person?: Record<string, unknown>;
|
||||
};
|
||||
parties: ReinquiryPartyResultDto[];
|
||||
}
|
||||
|
||||
export class ReinquiryInquiriesResponseDto {
|
||||
dryRun: boolean;
|
||||
docsSeen: number;
|
||||
blameDocsUpdated: number;
|
||||
claimDocsUpdated: number;
|
||||
results: ReinquiryCaseResultDto[];
|
||||
}
|
||||
Reference in New Issue
Block a user