forked from Yara724/api
Merge pull request 'main' (#292) from s.hajizadeh/yara724api:main into main
Reviewed-on: Yara724/api#292
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 { CarGreenCardDbService } from "./entites/db-service/car-green-card.db.service";
|
||||||
import { ClaimRequestManagementDbService } from "./entites/db-service/claim-request-management.db.service";
|
import { ClaimRequestManagementDbService } from "./entites/db-service/claim-request-management.db.service";
|
||||||
import { ClaimCaseDbService } from "./entites/db-service/claim-case.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 { BlameRequestDbService } from "src/request-management/entities/db-service/blame-request.db.service";
|
||||||
import { CreateClaimFromBlameResponseDto } from "./dto/create-claim-v2.dto";
|
import { CreateClaimFromBlameResponseDto } from "./dto/create-claim-v2.dto";
|
||||||
import {
|
import {
|
||||||
@@ -11157,14 +11158,7 @@ export class ClaimRequestManagementService {
|
|||||||
carAngles,
|
carAngles,
|
||||||
damagedParts,
|
damagedParts,
|
||||||
expertResend,
|
expertResend,
|
||||||
fanavaran:
|
fanavaran: fanavaranClaimReferences(claim),
|
||||||
claim.status === ClaimCaseStatus.COMPLETED &&
|
|
||||||
(claim.claimNo != null || claim.claimId != null)
|
|
||||||
? {
|
|
||||||
claimNo: claim.claimNo,
|
|
||||||
claimId: claim.claimId,
|
|
||||||
}
|
|
||||||
: undefined,
|
|
||||||
evaluation: mappedEvaluation
|
evaluation: mappedEvaluation
|
||||||
? {
|
? {
|
||||||
damageExpertReply: mappedEvaluation.damageExpertReply,
|
damageExpertReply: mappedEvaluation.damageExpertReply,
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ export class ClaimRequestManagementV2Controller {
|
|||||||
@ApiOperation({
|
@ApiOperation({
|
||||||
summary: "Get Claim Details (V2)",
|
summary: "Get Claim Details (V2)",
|
||||||
description:
|
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({
|
@ApiResponse({
|
||||||
status: 200,
|
status: 200,
|
||||||
|
|||||||
@@ -212,12 +212,19 @@ export class ClaimDetailsV2ResponseDto {
|
|||||||
|
|
||||||
@ApiPropertyOptional({
|
@ApiPropertyOptional({
|
||||||
description:
|
description:
|
||||||
'Fanavaran claim reference. Returned only after the local claim reaches COMPLETED and Fanavaran has supplied at least one reference.',
|
"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: { claimNo: 123456, claimId: 987654 },
|
example: {
|
||||||
|
claimId: 987654,
|
||||||
|
claimNo: 123456,
|
||||||
|
dmgCaseId: 11,
|
||||||
|
expertiseId: 22,
|
||||||
|
},
|
||||||
})
|
})
|
||||||
fanavaran?: {
|
fanavaran?: {
|
||||||
claimNo?: number;
|
|
||||||
claimId?: number;
|
claimId?: number;
|
||||||
|
claimNo?: number;
|
||||||
|
dmgCaseId?: number;
|
||||||
|
expertiseId?: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ApiPropertyOptional({
|
@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;
|
||||||
|
}
|
||||||
@@ -165,12 +165,19 @@ export class ClaimDetailV2ResponseDto {
|
|||||||
|
|
||||||
@ApiPropertyOptional({
|
@ApiPropertyOptional({
|
||||||
description:
|
description:
|
||||||
"Fanavaran claim reference. Returned only after the local claim reaches COMPLETED and Fanavaran has supplied at least one reference.",
|
"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: { claimNo: 123456, claimId: 987654 },
|
example: {
|
||||||
|
claimId: 987654,
|
||||||
|
claimNo: 123456,
|
||||||
|
dmgCaseId: 11,
|
||||||
|
expertiseId: 22,
|
||||||
|
},
|
||||||
})
|
})
|
||||||
fanavaran?: {
|
fanavaran?: {
|
||||||
claimNo?: number;
|
|
||||||
claimId?: number;
|
claimId?: number;
|
||||||
|
claimNo?: number;
|
||||||
|
dmgCaseId?: number;
|
||||||
|
expertiseId?: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ApiPropertyOptional({
|
@ApiPropertyOptional({
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ import {
|
|||||||
import { ClaimPerIdRs } from "./dto/claim-list-perId-rs.dto";
|
import { ClaimPerIdRs } from "./dto/claim-list-perId-rs.dto";
|
||||||
import { ClaimListDtoRs } from "./dto/claim-list-rs.dto";
|
import { ClaimListDtoRs } from "./dto/claim-list-rs.dto";
|
||||||
import { ClaimCaseDbService } from "src/claim-request-management/entites/db-service/claim-case.db.service";
|
import { ClaimCaseDbService } from "src/claim-request-management/entites/db-service/claim-case.db.service";
|
||||||
|
import { fanavaranClaimReferences } from "src/claim-request-management/fanavaran-claim-references";
|
||||||
import { ClaimCaseStatus } from "src/Types&Enums/claim-request-management/claim-case-status.enum";
|
import { ClaimCaseStatus } from "src/Types&Enums/claim-request-management/claim-case-status.enum";
|
||||||
import { ClaimStatus } from "src/Types&Enums/claim-request-management/claimStatus.enum";
|
import { ClaimStatus } from "src/Types&Enums/claim-request-management/claimStatus.enum";
|
||||||
import { RoleEnum } from "src/Types&Enums/role.enum";
|
import { RoleEnum } from "src/Types&Enums/role.enum";
|
||||||
@@ -5180,14 +5181,7 @@ export class ExpertClaimService {
|
|||||||
fileMakerApprovalActorId: (claim as any).fileMakerApprovalActorId
|
fileMakerApprovalActorId: (claim as any).fileMakerApprovalActorId
|
||||||
? String((claim as any).fileMakerApprovalActorId)
|
? String((claim as any).fileMakerApprovalActorId)
|
||||||
: undefined,
|
: undefined,
|
||||||
fanavaran:
|
fanavaran: fanavaranClaimReferences(claim),
|
||||||
claim.status === ClaimCaseStatus.COMPLETED &&
|
|
||||||
(claim.claimNo != null || claim.claimId != null)
|
|
||||||
? {
|
|
||||||
claimNo: claim.claimNo,
|
|
||||||
claimId: claim.claimId,
|
|
||||||
}
|
|
||||||
: undefined,
|
|
||||||
evaluation:
|
evaluation:
|
||||||
(evaluationForApi as
|
(evaluationForApi as
|
||||||
| ClaimDetailV2ResponseDto["evaluation"]
|
| ClaimDetailV2ResponseDto["evaluation"]
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ export class ExpertClaimV2Controller {
|
|||||||
@ApiOperation({
|
@ApiOperation({
|
||||||
summary: "Get claim request detail for damage expert",
|
summary: "Get claim request detail for damage expert",
|
||||||
description:
|
description:
|
||||||
"Returns full claim details including captured images, required documents, damage selections, `evaluation.priceDrop` (included whenever saved, regardless of current status), `videoCapture` (from claim-video-capture via media.videoCaptureId), and `blameCase` (linked blameCases document with party video/voice URLs like expert-blame detail). `evaluation.damageExpertReply` / `damageExpertReplyFinal` are always returned once submitted. Completed claims include Fanavaran `claimNo` / `claimId` when available. Allowed when status is WAITING_FOR_DAMAGE_EXPERT (if locked, only the locking expert) or when awaiting factor validation.",
|
"Returns full claim details including captured images, required documents, damage selections, `evaluation.priceDrop` (included whenever saved, regardless of current status), `videoCapture` (from claim-video-capture via media.videoCaptureId), and `blameCase` (linked blameCases document with party video/voice URLs like expert-blame detail). `evaluation.damageExpertReply` / `damageExpertReplyFinal` are always returned once submitted. Completed claims include Fanavaran `claimId` / `claimNo` / `dmgCaseId` / `expertiseId` when available. Allowed when status is WAITING_FOR_DAMAGE_EXPERT (if locked, only the locking expert) or when awaiting factor validation.",
|
||||||
})
|
})
|
||||||
@ApiParam({ name: "claimRequestId" })
|
@ApiParam({ name: "claimRequestId" })
|
||||||
async getClaimDetailV2(
|
async getClaimDetailV2(
|
||||||
|
|||||||
Reference in New Issue
Block a user