diff --git a/src/cvs/cvs.controller.ts b/src/cvs/cvs.controller.ts index dcc86303..1d3ce935 100644 --- a/src/cvs/cvs.controller.ts +++ b/src/cvs/cvs.controller.ts @@ -34,7 +34,7 @@ import { UserRoles, } from 'src/users/users.types'; import { isRoleIncluded } from 'src/users/users.utils'; -import { AdminZone, FilterParams } from 'src/utils/types'; +import { FilterParams } from 'src/utils/types'; import { CVsService } from './cvs.service'; import { CVFilterKey } from './cvs.types'; import { getPDFPaths } from './cvs.utils'; @@ -60,7 +60,6 @@ export class CVsController { @UserPayload() user: User, @UserPayload('id', new ParseUUIDPipe()) userId: string, @UserPayload('role') role: UserRole, - @UserPayload('zone') zone: AdminZone, @Param('candidateId', new ParseUUIDPipe()) candidateId: string, @Body('cv', new ParseCVPipe()) createCVDto: CreateCVDto, @Body('autoSave') autoSave: boolean, @@ -147,28 +146,17 @@ export class CVsController { const token = getTokenFromHeaders(req); - let isTwoPages = false; - - if ( - (createCVDto.experiences?.length || 0) + - (createCVDto.formations?.length || 0) > - 4 - ) { - isTwoPages = true; - } - // génération du CV en version PDF; exécution par lambda AWS await this.cvsService.sendGenerateCVPDF( candidateId, token, - `${firstName}_${lastName}`, - isTwoPages + `${firstName}_${lastName}` ); } return createdCV; } - /* + /* récupérer une liste de CVs publiés aléatoirement pour la gallerie */ @Public() @@ -216,17 +204,11 @@ export class CVsController { const pdfUrl = await this.cvsService.findPDF(s3Key); - const cv = await this.cvsService.findOneByCandidateId(candidateId); - - let isTwoPages = false; - if (cv.experiences?.length + cv.formations?.length > 4) isTwoPages = true; - if (!pdfUrl) { const createdPdfUrl = await this.cvsService.generatePDFFromCV( candidateId, getTokenFromHeaders(req), - fileName, - isTwoPages + fileName ); return { pdfUrl: createdPdfUrl, diff --git a/src/cvs/cvs.service.ts b/src/cvs/cvs.service.ts index 458afff2..b55fd406 100644 --- a/src/cvs/cvs.service.ts +++ b/src/cvs/cvs.service.ts @@ -657,8 +657,7 @@ export class CVsService { async generatePDFFromCV( candidateId: string, token: string, - /*paths: string[],*/ fileName: string, - isTwoPages: boolean + fileName: string ) { const response = await fetch(`${process.env.CV_PDF_GENERATION_AWS_URL}`, { headers: { @@ -670,7 +669,6 @@ export class CVsService { candidateId, token, fileName, - isTwoPages, }), }); @@ -1108,14 +1106,12 @@ export class CVsService { async sendGenerateCVPDF( candidateId: string, token: string, - fileName: string, - isTwoPages: boolean + fileName: string ) { await this.queuesService.addToWorkQueue(Jobs.GENERATE_CV_PDF, { candidateId, token, fileName, - isTwoPages, }); } diff --git a/src/queues/consumers/work-queue.processor.ts b/src/queues/consumers/work-queue.processor.ts index 8bc9aa38..dd668003 100644 --- a/src/queues/consumers/work-queue.processor.ts +++ b/src/queues/consumers/work-queue.processor.ts @@ -321,8 +321,7 @@ export class WorkQueueProcessor { await this.cvsService.generatePDFFromCV( data.candidateId, data.token, - data.fileName, - data.isTwoPages + data.fileName ); await this.pusherService.sendEvent( diff --git a/src/queues/queues.types.ts b/src/queues/queues.types.ts index cf65f71c..136d5d97 100644 --- a/src/queues/queues.types.ts +++ b/src/queues/queues.types.ts @@ -126,7 +126,6 @@ export interface GenerateCVPDFJob { candidateId: string; token: string; fileName: string; - isTwoPages: boolean; } export interface GenerateCVPreviewJob {