update the lookups list

This commit is contained in:
2026-09-07 15:08:08 +03:30
parent 80e112f09b
commit c7cd9e8ce5
11 changed files with 1161 additions and 72 deletions

View File

@@ -331,7 +331,7 @@ export class LookupsController {
@ApiOperation({
summary: "Fanavaran vehicle inquiry by VIN",
description:
"Returns vehicle details from Fanavaran for the given VIN number via car/vehicles/inquiry-by-vin.",
"GET car/vehicles/inquiry-by-vin. Response includes UsedId (AccidentVehicleUsedId), VehicleKindId, plus vehicleKind/used lookup rows. Prefer this over vehicle GET when you already have the VIN.",
})
@ApiQuery({
name: "vin",
@@ -346,6 +346,42 @@ export class LookupsController {
return await this.lookupsService.inquiryByVin(vin);
}
@Get("inquiry-by-unique-identifier")
@ApiOperation({
summary: "Fanavaran party inquiry by national code and birthday",
description:
"GET common/parties/inquiry-by-unique-identifier. Use this to resolve GEN.12 DriverId. Pass birthday as 13480313 or 1348/03/13, or birthYear+birthMonth+birthDay.",
})
@ApiQuery({ name: "nationalCode", example: "0012345678" })
@ApiQuery({
name: "birthday",
required: false,
example: "13480313",
description: "Jalali birthday compact (13480313) or delimited (1348/03/13)",
})
@ApiQuery({ name: "birthYear", required: false, example: 1348 })
@ApiQuery({ name: "birthMonth", required: false, example: 3 })
@ApiQuery({ name: "birthDay", required: false, example: 13 })
@ApiOkResponse({
description: "Fanavaran parties plus picked driverId / insurerId",
schema: { type: "object" },
})
async inquiryByUniqueIdentifier(
@Query("nationalCode") nationalCode?: string,
@Query("birthday") birthday?: string,
@Query("birthYear") birthYear?: string,
@Query("birthMonth") birthMonth?: string,
@Query("birthDay") birthDay?: string,
) {
return await this.lookupsService.inquiryByUniqueIdentifier({
nationalCode,
birthday,
birthYear,
birthMonth,
birthDay,
});
}
@Get("fanavaran")
@ApiOperation({
summary: "List configured Fanavaran remote lookups",
@@ -627,4 +663,41 @@ export class LookupsController {
async bodyPolicyById(@Param("policyId", ParseIntPipe) policyId: number) {
return await this.lookupsService.bodyPolicyById(policyId);
}
@Get("vehicle/:vehicleId")
@ApiOperation({
summary: "Fanavaran vehicle by id",
description:
"GET car/vehicles/{vehicleId} after a third-party/hull policy returns VehicleId. Pass the policy VehicleVersionNo when you need that exact version; omit it for the latest version. Response includes vehicleKind (VehicleGroupId) and used (UsedId) lookup rows.",
})
@ApiParam({
name: "vehicleId",
description: "Fanavaran vehicle id from the policy VehicleId field",
example: 3379978,
})
@ApiQuery({
name: "versionNo",
required: false,
description:
"Policy VehicleVersionNo. Omit to fetch the latest vehicle version.",
example: 2,
})
@ApiOkResponse({
description:
"Vehicle record plus vehicleKind, used, plaque, and color placeholders",
schema: { type: "object" },
})
async vehicleById(
@Param("vehicleId", ParseIntPipe) vehicleId: number,
@Query("versionNo") versionNo?: string,
) {
const parsedVersion =
versionNo == null || String(versionNo).trim() === ""
? undefined
: Number(versionNo);
return await this.lookupsService.vehicleById(
vehicleId,
Number.isFinite(parsedVersion) ? parsedVersion : undefined,
);
}
}