forked from Yara724/api
YARA-711
This commit is contained in:
@@ -7,6 +7,7 @@ import {
|
|||||||
} from "@nestjs/common";
|
} from "@nestjs/common";
|
||||||
import { InjectModel } from "@nestjs/mongoose";
|
import { InjectModel } from "@nestjs/mongoose";
|
||||||
import { Model, Types } from "mongoose";
|
import { Model, Types } from "mongoose";
|
||||||
|
import { ClaimRequiredDocumentDbService } from "src/claim-request-management/entites/db-service/claim-required-document.db.service";
|
||||||
import { VideoCaptureDbService } from "src/claim-request-management/entites/db-service/video-capture.db.service";
|
import { VideoCaptureDbService } from "src/claim-request-management/entites/db-service/video-capture.db.service";
|
||||||
import { ClaimRequestManagementModel } from "src/claim-request-management/entites/schema/claim-request-management.schema";
|
import { ClaimRequestManagementModel } from "src/claim-request-management/entites/schema/claim-request-management.schema";
|
||||||
import { CreateBranchDto } from "src/client/dto/create-branch.dto";
|
import { CreateBranchDto } from "src/client/dto/create-branch.dto";
|
||||||
@@ -42,6 +43,7 @@ export class ExpertInsurerService {
|
|||||||
private readonly userSignDbService: UserSignDbService,
|
private readonly userSignDbService: UserSignDbService,
|
||||||
private readonly claimVideoCaptureDbService: VideoCaptureDbService,
|
private readonly claimVideoCaptureDbService: VideoCaptureDbService,
|
||||||
private readonly branchDbService: BranchDbService,
|
private readonly branchDbService: BranchDbService,
|
||||||
|
private readonly claimRequiredDocumentDbService: ClaimRequiredDocumentDbService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
async retrieveAllExpertsOfClient(
|
async retrieveAllExpertsOfClient(
|
||||||
@@ -315,6 +317,35 @@ export class ExpertInsurerService {
|
|||||||
const claimFilesRaw = await this.claimRequestManagementModel
|
const claimFilesRaw = await this.claimRequestManagementModel
|
||||||
.find({
|
.find({
|
||||||
userClientKey: id,
|
userClientKey: id,
|
||||||
|
}, {
|
||||||
|
_id: 1,
|
||||||
|
requestNumber: 1,
|
||||||
|
userClientKey: 1,
|
||||||
|
userId: 1,
|
||||||
|
fullName: 1,
|
||||||
|
carDetail: 1,
|
||||||
|
carPlate: 1,
|
||||||
|
claimStatus: 1,
|
||||||
|
currentStep: 1,
|
||||||
|
nextStep: 1,
|
||||||
|
carPartDamage: 1,
|
||||||
|
otherParts: 1,
|
||||||
|
sheba: 1,
|
||||||
|
nationalCodeOfInsurer: 1,
|
||||||
|
carGreenCard: 1,
|
||||||
|
aiImages: 1,
|
||||||
|
videoCaptureId: 1,
|
||||||
|
damageExpertReply: 1,
|
||||||
|
damageExpertReplyFinal: 1,
|
||||||
|
damageExpertResend: 1,
|
||||||
|
objection: 1,
|
||||||
|
userResendDocuments: 1,
|
||||||
|
priceDrop: 1,
|
||||||
|
requiredDocuments: 1,
|
||||||
|
createdAt: 1,
|
||||||
|
updatedAt: 1,
|
||||||
|
rating: 1,
|
||||||
|
visitLocation: 1,
|
||||||
})
|
})
|
||||||
.lean();
|
.lean();
|
||||||
|
|
||||||
@@ -391,6 +422,23 @@ export class ExpertInsurerService {
|
|||||||
if (videoDoc) claimFile.videoCaptureId = buildFileLink(videoDoc.path);
|
if (videoDoc) claimFile.videoCaptureId = buildFileLink(videoDoc.path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (claimFile.requiredDocuments) {
|
||||||
|
const documents = await this.claimRequiredDocumentDbService.findByClaimId(
|
||||||
|
claimFile._id.toString(),
|
||||||
|
);
|
||||||
|
|
||||||
|
// Populate with file URLs
|
||||||
|
const populatedDocuments = documents.map((doc) => ({
|
||||||
|
_id: doc._id,
|
||||||
|
documentType: doc.documentType,
|
||||||
|
fileName: doc.fileName,
|
||||||
|
fileUrl: buildFileLink(doc.path),
|
||||||
|
uploadedAt: doc.uploadedAt,
|
||||||
|
}));
|
||||||
|
|
||||||
|
claimFile.requiredDocuments = populatedDocuments;
|
||||||
|
}
|
||||||
|
|
||||||
return claimFile;
|
return claimFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user