fixed branch being mandatory

This commit is contained in:
SepehrYahyaee
2026-09-12 10:18:17 +03:30
parent 55da8188a9
commit ebe45646c1
7 changed files with 209 additions and 1 deletions

View File

@@ -104,6 +104,69 @@ describe("RequestManagementService FileReviewer inbox", () => {
).rejects.toThrow("does not belong to your organization");
});
it("returns party identity, VIN plate and claim payment/reference data to the V4 reviewer", async () => {
const { service } = createService([]);
const request = {
...sealedFile,
parties: [
{
role: "FIRST",
person: {
clientId,
fullName: "راننده و بیمه‌گذار نمونه",
nationalCodeOfInsurer: "1111111111",
nationalCodeOfDriver: "2222222222",
driverIsInsurer: false,
licenseType: "پایه یک",
driverLicense: "L-123",
},
vehicle: { plateId: "11-22-ب-333", vin: "VIN-123" },
},
],
};
(service as any).blameRequestDbService.findById = jest
.fn()
.mockResolvedValue(request);
(service as any).claimCaseDbService = {
findOne: jest.fn().mockResolvedValue({
_id: new Types.ObjectId(),
status: "COMPLETED",
workflow: {},
money: { sheba: "IR123" },
claimId: 101,
fanavaranSync: { baseClaim: { policyId: 202 } },
}),
};
const result = await service.getMyFileReviewerFileDetail(
{
sub: String(reviewerId),
role: RoleEnum.FILE_REVIEWER,
clientKey: String(clientId),
},
String(sealedFile._id),
);
expect(result.parties[0]).toEqual(
expect.objectContaining({
person: expect.objectContaining({
fullName: "راننده و بیمه‌گذار نمونه",
nationalCodeOfInsurer: "1111111111",
nationalCodeOfDriver: "2222222222",
licenseType: "پایه یک",
}),
vehicle: expect.objectContaining({
plateId: "11-22-ب-333",
vin: "VIN-123",
}),
}),
);
expect(result.money).toEqual({ sheba: "IR123" });
expect(result.fanavaran).toEqual(
expect.objectContaining({ claimId: 101, policyId: 202 }),
);
});
it("does not let a reviewer claim another tenant's file through its linked claim ID", async () => {
const blameRequestDbService = {
findById: jest.fn().mockResolvedValue({

View File

@@ -116,6 +116,7 @@ import {
} from "src/helpers/tenant-scope";
import { resolveLinkedUserIdStrings } from "src/helpers/user-access-resolver";
import { normalizePlateText } from "src/utils/plate-normalizer/plate-normalizer.service";
import { fanavaranClaimReferences } from "src/claim-request-management/fanavaran-claim-references";
/**
* Formats a compact Jalali date (number or string like 13780624) as YYYY/MM/DD.
@@ -11530,10 +11531,15 @@ export class RequestManagementService {
parties: (plain.parties ?? []).map((p: any) => ({
role: p.role,
person: {
fullName: p.person?.fullName,
phoneNumber: p.person?.phoneNumber,
nationalCodeOfInsurer: p.person?.nationalCodeOfInsurer,
nationalCodeOfDriver: p.person?.nationalCodeOfDriver,
driverIsInsurer: p.person?.driverIsInsurer,
insurerBirthday: p.person?.insurerBirthday,
driverBirthday: p.person?.driverBirthday,
insurerLicense: p.person?.insurerLicense,
driverLicense: p.person?.driverLicense,
userId: p.person?.userId ? String(p.person.userId) : undefined,
clientId: p.person?.clientId ? String(p.person.clientId) : undefined,
licenseType: p.person?.licenseType ?? undefined,
@@ -11547,6 +11553,7 @@ export class RequestManagementService {
} : undefined,
vehicle: p.vehicle ? {
plateId: p.vehicle.plateId,
vin: p.vehicle.vin,
name: p.vehicle.name,
type: p.vehicle.type,
} : undefined,
@@ -11557,6 +11564,8 @@ export class RequestManagementService {
...(claimPlain ? {
claimStatus: claimPlain.status,
claimWorkflow: claimPlain.workflow,
money: claimPlain.money ?? null,
fanavaran: fanavaranClaimReferences(claimPlain),
fileMakerRejectionCount: claimPlain.fileMakerRejectionCount ?? 0,
fileMakerRejectionReason: claimPlain.fileMakerRejectionReason ?? null,
evaluation: claimPlain.evaluation
@@ -11682,10 +11691,15 @@ export class RequestManagementService {
parties: (plain.parties ?? []).map((p: any) => ({
role: p.role,
person: {
fullName: p.person?.fullName,
phoneNumber: p.person?.phoneNumber,
nationalCodeOfInsurer: p.person?.nationalCodeOfInsurer,
nationalCodeOfDriver: p.person?.nationalCodeOfDriver,
driverIsInsurer: p.person?.driverIsInsurer,
insurerBirthday: p.person?.insurerBirthday,
driverBirthday: p.person?.driverBirthday,
insurerLicense: p.person?.insurerLicense,
driverLicense: p.person?.driverLicense,
userId: p.person?.userId ? String(p.person.userId) : undefined,
clientId: p.person?.clientId ? String(p.person.clientId) : undefined,
licenseType: p.person?.licenseType ?? undefined,
@@ -11699,6 +11713,7 @@ export class RequestManagementService {
} : undefined,
vehicle: p.vehicle ? {
plateId: p.vehicle.plateId,
vin: p.vehicle.vin,
name: p.vehicle.name,
type: p.vehicle.type,
} : undefined,
@@ -11719,6 +11734,8 @@ export class RequestManagementService {
...(claimPlain ? {
claimStatus: claimPlain.status,
claimWorkflow: claimPlain.workflow,
money: claimPlain.money ?? null,
fanavaran: fanavaranClaimReferences(claimPlain),
fileMakerRejectionCount: claimPlain.fileMakerRejectionCount ?? 0,
fileMakerRejectionReason: claimPlain.fileMakerRejectionReason ?? null,
evaluation: claimPlain.evaluation