forked from Yara724/api
update yara
This commit is contained in:
@@ -35,6 +35,7 @@ import { UserObjectionV2Dto } from "./dto/user-objection-v2.dto";
|
||||
import { CarGreenCardDbService } from "./entites/db-service/car-green-card.db.service";
|
||||
import { ClaimRequestManagementDbService } from "./entites/db-service/claim-request-management.db.service";
|
||||
import { ClaimCaseDbService } from "./entites/db-service/claim-case.db.service";
|
||||
import { fanavaranClaimReferences } from "./fanavaran-claim-references";
|
||||
import { BlameRequestDbService } from "src/request-management/entities/db-service/blame-request.db.service";
|
||||
import { CreateClaimFromBlameResponseDto } from "./dto/create-claim-v2.dto";
|
||||
import {
|
||||
@@ -11157,14 +11158,7 @@ export class ClaimRequestManagementService {
|
||||
carAngles,
|
||||
damagedParts,
|
||||
expertResend,
|
||||
fanavaran:
|
||||
claim.status === ClaimCaseStatus.COMPLETED &&
|
||||
(claim.claimNo != null || claim.claimId != null)
|
||||
? {
|
||||
claimNo: claim.claimNo,
|
||||
claimId: claim.claimId,
|
||||
}
|
||||
: undefined,
|
||||
fanavaran: fanavaranClaimReferences(claim),
|
||||
evaluation: mappedEvaluation
|
||||
? {
|
||||
damageExpertReply: mappedEvaluation.damageExpertReply,
|
||||
|
||||
@@ -117,7 +117,7 @@ export class ClaimRequestManagementV2Controller {
|
||||
@ApiOperation({
|
||||
summary: "Get Claim Details (V2)",
|
||||
description:
|
||||
"Returns the claim snapshot for an authorized **USER**, **FIELD_EXPERT**, **REGISTRAR**, **FILE_MAKER**, or assigned **FILE_REVIEWER**. Initiating experts/registrars see unmasked money fields; owners get `ownerGuidance`. Completed claims include Fanavaran `claimNo` / `claimId` when available.",
|
||||
"Returns the claim snapshot for an authorized **USER**, **FIELD_EXPERT**, **REGISTRAR**, **FILE_MAKER**, or assigned **FILE_REVIEWER**. Initiating experts/registrars see unmasked money fields; owners get `ownerGuidance`. Completed claims include Fanavaran `claimId` / `claimNo` / `dmgCaseId` / `expertiseId` when available.",
|
||||
})
|
||||
@ApiResponse({
|
||||
status: 200,
|
||||
|
||||
@@ -212,12 +212,19 @@ export class ClaimDetailsV2ResponseDto {
|
||||
|
||||
@ApiPropertyOptional({
|
||||
description:
|
||||
'Fanavaran claim reference. Returned only after the local claim reaches COMPLETED and Fanavaran has supplied at least one reference.',
|
||||
example: { claimNo: 123456, claimId: 987654 },
|
||||
"Fanavaran claim reference. Returned only after the local claim reaches COMPLETED. Each of claimId, claimNo, dmgCaseId, and expertiseId is included when Fanavaran has supplied it.",
|
||||
example: {
|
||||
claimId: 987654,
|
||||
claimNo: 123456,
|
||||
dmgCaseId: 11,
|
||||
expertiseId: 22,
|
||||
},
|
||||
})
|
||||
fanavaran?: {
|
||||
claimNo?: number;
|
||||
claimId?: number;
|
||||
claimNo?: number;
|
||||
dmgCaseId?: number;
|
||||
expertiseId?: number;
|
||||
};
|
||||
|
||||
@ApiPropertyOptional({
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
import { ClaimCaseStatus } from "src/Types&Enums/claim-request-management/claim-case-status.enum";
|
||||
import { fanavaranClaimReferences } from "./fanavaran-claim-references";
|
||||
|
||||
describe("fanavaranClaimReferences", () => {
|
||||
it("returns all four Fanavaran ids when the claim is completed", () => {
|
||||
expect(
|
||||
fanavaranClaimReferences({
|
||||
status: ClaimCaseStatus.COMPLETED,
|
||||
claimId: 987654,
|
||||
claimNo: 123456,
|
||||
dmgCaseId: 11,
|
||||
expertiseId: 22,
|
||||
}),
|
||||
).toEqual({
|
||||
claimId: 987654,
|
||||
claimNo: 123456,
|
||||
dmgCaseId: 11,
|
||||
expertiseId: 22,
|
||||
});
|
||||
});
|
||||
|
||||
it("omits missing ids", () => {
|
||||
expect(
|
||||
fanavaranClaimReferences({
|
||||
status: ClaimCaseStatus.COMPLETED,
|
||||
claimId: 987654,
|
||||
claimNo: null,
|
||||
dmgCaseId: undefined,
|
||||
expertiseId: 22,
|
||||
}),
|
||||
).toEqual({
|
||||
claimId: 987654,
|
||||
expertiseId: 22,
|
||||
});
|
||||
});
|
||||
|
||||
it("returns undefined before the claim is completed", () => {
|
||||
expect(
|
||||
fanavaranClaimReferences({
|
||||
status: ClaimCaseStatus.EXPERT_REVIEWING,
|
||||
claimId: 987654,
|
||||
dmgCaseId: 11,
|
||||
}),
|
||||
).toBeUndefined();
|
||||
});
|
||||
});
|
||||
31
src/claim-request-management/fanavaran-claim-references.ts
Normal file
31
src/claim-request-management/fanavaran-claim-references.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import { ClaimCaseStatus } from "src/Types&Enums/claim-request-management/claim-case-status.enum";
|
||||
|
||||
export type FanavaranClaimReferences = {
|
||||
claimId?: number;
|
||||
claimNo?: number;
|
||||
dmgCaseId?: number;
|
||||
expertiseId?: number;
|
||||
};
|
||||
|
||||
/**
|
||||
* Fanavaran ids for v2 claim GET. Only on COMPLETED; each field is omitted when missing.
|
||||
*/
|
||||
export function fanavaranClaimReferences(claim: {
|
||||
status?: string;
|
||||
claimId?: number | null;
|
||||
claimNo?: number | null;
|
||||
dmgCaseId?: number | null;
|
||||
expertiseId?: number | null;
|
||||
}): FanavaranClaimReferences | undefined {
|
||||
if (claim.status !== ClaimCaseStatus.COMPLETED) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const refs: FanavaranClaimReferences = {};
|
||||
if (claim.claimId != null) refs.claimId = claim.claimId;
|
||||
if (claim.claimNo != null) refs.claimNo = claim.claimNo;
|
||||
if (claim.dmgCaseId != null) refs.dmgCaseId = claim.dmgCaseId;
|
||||
if (claim.expertiseId != null) refs.expertiseId = claim.expertiseId;
|
||||
|
||||
return Object.keys(refs).length > 0 ? refs : undefined;
|
||||
}
|
||||
Reference in New Issue
Block a user