1
0
forked from Yara724/api

YARA-1182

This commit is contained in:
SepehrYahyaee
2026-07-29 16:53:36 +03:30
parent ea4fcbe713
commit e742d43201
2 changed files with 54 additions and 5 deletions

View File

@@ -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 },

View File

@@ -10667,7 +10667,7 @@ export class RequestManagementService {
agent: any,
requestId: string,
dto: Omit<RunInquiriesV3Dto, "sheba">,
): Promise<{ blameRequestId: string; message: string }> {
): Promise<Record<string, unknown>> {
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,
};
}