car body policy and sales extended

This commit is contained in:
2026-09-05 18:37:42 +03:30
parent eb072ef080
commit eb636bdbdd
10 changed files with 1097 additions and 14 deletions

View File

@@ -520,6 +520,74 @@ export class LookupsController {
);
}
@Get("processed-third-party-policy")
@ApiOperation({
summary: "Last processed third-party policy for a car",
description:
"Lists Fanavaran policies by national code (InsuranceLineId=5), hydrates each with the third-party policy GET and vehicle GET, matches VIN (preferred) and/or the four plaque parts, then returns that car's last policy. VIN/plaque never open the policy list.",
})
@ApiQuery({ name: "nationalCode", example: "0012345678" })
@ApiQuery({ name: "vin", required: false, example: "IRNKAEK4150012345" })
@ApiQuery({ name: "plaqueLeft", required: false, example: "12" })
@ApiQuery({ name: "plaqueLetter", required: false, example: "ب" })
@ApiQuery({ name: "plaqueRight", required: false, example: "345" })
@ApiQuery({ name: "plaqueSerial", required: false, example: "67" })
@ApiOkResponse({
description: "Mapped last third-party policy plus vehicle",
schema: { type: "object" },
})
async processedThirdPartyPolicy(
@Query("nationalCode") nationalCode?: string,
@Query("vin") vin?: string,
@Query("plaqueLeft") plaqueLeft?: string,
@Query("plaqueLetter") plaqueLetter?: string,
@Query("plaqueRight") plaqueRight?: string,
@Query("plaqueSerial") plaqueSerial?: string,
) {
return this.lookupsService.findLastProcessedCarPolicy("third-party", {
nationalCode,
vin,
plaqueLeft,
plaqueLetter,
plaqueRight,
plaqueSerial,
});
}
@Get("processed-body-policy")
@ApiOperation({
summary: "Last processed car-body (hull) policy for a car",
description:
"Same car-matching flow as processed-third-party-policy, using InsuranceLineId=4 and the hull policy GET. Uses hull ContractId when configured.",
})
@ApiQuery({ name: "nationalCode", example: "0012345678" })
@ApiQuery({ name: "vin", required: false, example: "IRNKAEK4150012345" })
@ApiQuery({ name: "plaqueLeft", required: false, example: "12" })
@ApiQuery({ name: "plaqueLetter", required: false, example: "ب" })
@ApiQuery({ name: "plaqueRight", required: false, example: "345" })
@ApiQuery({ name: "plaqueSerial", required: false, example: "67" })
@ApiOkResponse({
description: "Mapped last body policy plus vehicle",
schema: { type: "object" },
})
async processedBodyPolicy(
@Query("nationalCode") nationalCode?: string,
@Query("vin") vin?: string,
@Query("plaqueLeft") plaqueLeft?: string,
@Query("plaqueLetter") plaqueLetter?: string,
@Query("plaqueRight") plaqueRight?: string,
@Query("plaqueSerial") plaqueSerial?: string,
) {
return this.lookupsService.findLastProcessedCarPolicy("car-body", {
nationalCode,
vin,
plaqueLeft,
plaqueLetter,
plaqueRight,
plaqueSerial,
});
}
@Get("third-party-policy/:policyId")
@ApiOperation({
summary: "Third-party car policy inquiry by policy ID",