diff --git a/src/auth/auth-services/user.auth.service.ts b/src/auth/auth-services/user.auth.service.ts index 3d1ba7f..0805592 100644 --- a/src/auth/auth-services/user.auth.service.ts +++ b/src/auth/auth-services/user.auth.service.ts @@ -77,7 +77,7 @@ export class UserAuthService { role: "user", }; const accToken = this.jwtService.sign(payload, { - secret: `${process.env.JWT_SECRET}`, + secret: `${process.env.JWT_SECRET}`, expiresIn: '1h' }); await this.userDbService.findOneAndUpdate( { username: user.username }, diff --git a/src/request-management/request-management.service.ts b/src/request-management/request-management.service.ts index 1be3687..46b4b2d 100644 --- a/src/request-management/request-management.service.ts +++ b/src/request-management/request-management.service.ts @@ -10667,7 +10667,7 @@ export class RequestManagementService { agent: any, requestId: string, dto: Omit, - ): Promise<{ blameRequestId: string; message: string }> { + ): Promise> { if (agent?.role !== RoleEnum.CALL_CENTER) { throw new ForbiddenException("Only call-center agents can use this endpoint."); } @@ -10695,9 +10695,41 @@ export class RequestManagementService { }); await (req as any).save(); + // Return the inquiry-populated data so the agent can review before sending the link. + const firstPartyAfter = req.parties[firstIdx]; return { blameRequestId: requestId, + publicId: (req as any).publicId, + type: (req as any).type, + status: (req as any).status, message: "Guilty-party inquiry complete. You can now send the blame link to the user.", + guiltyParty: { + vehicle: firstPartyAfter?.vehicle + ? { + plateId: firstPartyAfter.vehicle.plateId, + name: firstPartyAfter.vehicle.name, + type: firstPartyAfter.vehicle.type, + } + : undefined, + insurance: firstPartyAfter?.insurance + ? { + company: firstPartyAfter.insurance.company, + policyNumber: firstPartyAfter.insurance.policyNumber, + startDate: firstPartyAfter.insurance.startDate, + endDate: firstPartyAfter.insurance.endDate, + financialCeiling: (firstPartyAfter.insurance as any).financialCeiling, + } + : undefined, + person: firstPartyAfter?.person + ? { + nationalCodeOfInsurer: firstPartyAfter.person.nationalCodeOfInsurer, + nationalCodeOfDriver: firstPartyAfter.person.nationalCodeOfDriver, + driverIsInsurer: firstPartyAfter.person.driverIsInsurer, + insurerBirthday: firstPartyAfter.person.insurerBirthday, + driverBirthday: firstPartyAfter.person.driverBirthday, + } + : undefined, + }, }; } @@ -10778,14 +10810,24 @@ export class RequestManagementService { type: (req as any).type, status: (req as any).status, blameStatus: (req as any).blameStatus, - workflow: (req as any).workflow, + workflow: { + currentStep: (req as any).workflow?.currentStep, + nextStep: (req as any).workflow?.nextStep, + completedSteps: (req as any).workflow?.completedSteps, + }, skipInitialFormStep: (req as any).skipInitialFormStep, parties: ((req as any).parties ?? []).map((p: any) => ({ role: p.role, person: { phoneNumber: p.person?.phoneNumber, nationalCodeOfInsurer: p.person?.nationalCodeOfInsurer, - clientId: p.person?.clientId, + nationalCodeOfDriver: p.person?.nationalCodeOfDriver, + driverIsInsurer: p.person?.driverIsInsurer, + insurerBirthday: p.person?.insurerBirthday, + driverBirthday: p.person?.driverBirthday, + clientId: p.person?.clientId + ? String(p.person.clientId) + : undefined, }, insurance: p.insurance ? { @@ -10793,13 +10835,20 @@ export class RequestManagementService { policyNumber: p.insurance.policyNumber, startDate: p.insurance.startDate, endDate: p.insurance.endDate, + financialCeiling: p.insurance.financialCeiling, } : undefined, vehicle: p.vehicle - ? { plateId: p.vehicle.plateId, name: p.vehicle.name } + ? { + plateId: p.vehicle.plateId, + name: p.vehicle.name, + type: p.vehicle.type, + } : undefined, + inquiryComplete: !!(p.person?.inquiriesCompleted), })), createdAt: (req as any).createdAt, + updatedAt: (req as any).updatedAt, }; }