forked from Yara724/api
Merge pull request 'YARA-1182' (#232) from s.yahyaee/yara724-api:main into main
Reviewed-on: Yara724/api#232
This commit is contained in:
@@ -77,7 +77,7 @@ export class UserAuthService {
|
|||||||
role: "user",
|
role: "user",
|
||||||
};
|
};
|
||||||
const accToken = this.jwtService.sign(payload, {
|
const accToken = this.jwtService.sign(payload, {
|
||||||
secret: `${process.env.JWT_SECRET}`,
|
secret: `${process.env.JWT_SECRET}`, expiresIn: '1h'
|
||||||
});
|
});
|
||||||
await this.userDbService.findOneAndUpdate(
|
await this.userDbService.findOneAndUpdate(
|
||||||
{ username: user.username },
|
{ username: user.username },
|
||||||
|
|||||||
@@ -10667,7 +10667,7 @@ export class RequestManagementService {
|
|||||||
agent: any,
|
agent: any,
|
||||||
requestId: string,
|
requestId: string,
|
||||||
dto: Omit<RunInquiriesV3Dto, "sheba">,
|
dto: Omit<RunInquiriesV3Dto, "sheba">,
|
||||||
): Promise<{ blameRequestId: string; message: string }> {
|
): Promise<Record<string, unknown>> {
|
||||||
if (agent?.role !== RoleEnum.CALL_CENTER) {
|
if (agent?.role !== RoleEnum.CALL_CENTER) {
|
||||||
throw new ForbiddenException("Only call-center agents can use this endpoint.");
|
throw new ForbiddenException("Only call-center agents can use this endpoint.");
|
||||||
}
|
}
|
||||||
@@ -10695,9 +10695,41 @@ export class RequestManagementService {
|
|||||||
});
|
});
|
||||||
await (req as any).save();
|
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 {
|
return {
|
||||||
blameRequestId: requestId,
|
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.",
|
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,
|
type: (req as any).type,
|
||||||
status: (req as any).status,
|
status: (req as any).status,
|
||||||
blameStatus: (req as any).blameStatus,
|
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,
|
skipInitialFormStep: (req as any).skipInitialFormStep,
|
||||||
parties: ((req as any).parties ?? []).map((p: any) => ({
|
parties: ((req as any).parties ?? []).map((p: any) => ({
|
||||||
role: p.role,
|
role: p.role,
|
||||||
person: {
|
person: {
|
||||||
phoneNumber: p.person?.phoneNumber,
|
phoneNumber: p.person?.phoneNumber,
|
||||||
nationalCodeOfInsurer: p.person?.nationalCodeOfInsurer,
|
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
|
insurance: p.insurance
|
||||||
? {
|
? {
|
||||||
@@ -10793,13 +10835,20 @@ export class RequestManagementService {
|
|||||||
policyNumber: p.insurance.policyNumber,
|
policyNumber: p.insurance.policyNumber,
|
||||||
startDate: p.insurance.startDate,
|
startDate: p.insurance.startDate,
|
||||||
endDate: p.insurance.endDate,
|
endDate: p.insurance.endDate,
|
||||||
|
financialCeiling: p.insurance.financialCeiling,
|
||||||
}
|
}
|
||||||
: undefined,
|
: undefined,
|
||||||
vehicle: p.vehicle
|
vehicle: p.vehicle
|
||||||
? { plateId: p.vehicle.plateId, name: p.vehicle.name }
|
? {
|
||||||
|
plateId: p.vehicle.plateId,
|
||||||
|
name: p.vehicle.name,
|
||||||
|
type: p.vehicle.type,
|
||||||
|
}
|
||||||
: undefined,
|
: undefined,
|
||||||
|
inquiryComplete: !!(p.person?.inquiriesCompleted),
|
||||||
})),
|
})),
|
||||||
createdAt: (req as any).createdAt,
|
createdAt: (req as any).createdAt,
|
||||||
|
updatedAt: (req as any).updatedAt,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user