Delegated the PDF creation task for FE, and BE now only returns the necessary data for it

This commit is contained in:
SepehrYahyaee
2026-08-16 11:52:26 +03:30
parent 85d7881b2b
commit 875b52d761
5 changed files with 16 additions and 68 deletions

View File

@@ -1,20 +1,18 @@
import { Injectable, NotFoundException } from "@nestjs/common";
import { ExpertInsurerService } from "src/expert-insurer/expert-insurer.service";
import { buildInsurerFileReport } from "./case-expert-report.builder";
import { CaseExpertReportPdfService } from "./case-expert-report-pdf.service";
import { InsurerFileReportPdfResult } from "./case-expert-report.types";
import { InsurerFileReportViewModel } from "./case-expert-report.types";
@Injectable()
export class CaseExpertReportService {
constructor(
private readonly expertInsurerService: ExpertInsurerService,
private readonly pdfService: CaseExpertReportPdfService,
) {}
async generateForInsurer(
publicId: string,
actor: { clientKey?: string },
): Promise<InsurerFileReportPdfResult> {
): Promise<InsurerFileReportViewModel> {
const clientKey = actor?.clientKey;
if (!clientKey) {
throw new NotFoundException("Insurer context not found");
@@ -24,7 +22,6 @@ export class CaseExpertReportService {
clientKey,
publicId,
);
const model = buildInsurerFileReport(file);
return this.pdfService.render(model);
return buildInsurerFileReport(file);
}
}