forked from Yara724/api
blame and claim refactored
This commit is contained in:
@@ -25,7 +25,7 @@ import { InsurerExpertDbService } from "src/users/entities/db-service/insurer-ex
|
||||
import { DamageExpertDbService } from "src/users/entities/db-service/damage-expert.db.service";
|
||||
import { ExpertDbService } from "src/users/entities/db-service/expert.db.service";
|
||||
import { HashService } from "src/utils/hash/hash.service";
|
||||
import { MailService } from "src/utils/mail/mail.service";
|
||||
// import { MailService } from "src/utils/mail/mail.service";
|
||||
import { OtpService } from "src/utils/otp/otp.service";
|
||||
|
||||
function pick(obj: Record<string, any>, keys: string[]) {
|
||||
@@ -45,7 +45,7 @@ export class ActorAuthService {
|
||||
private readonly expertDbService: ExpertDbService,
|
||||
private readonly damageExpertDbService: DamageExpertDbService,
|
||||
private readonly insurerExpertDbService: InsurerExpertDbService,
|
||||
private readonly mailService: MailService,
|
||||
// private readonly mailService: MailService, // Mailer disabled – not used
|
||||
private readonly clientDbService: ClientDbService,
|
||||
private readonly otpService: OtpService,
|
||||
) {}
|
||||
@@ -264,17 +264,19 @@ export class ActorAuthService {
|
||||
}
|
||||
|
||||
const otp = this.otpService.create();
|
||||
const sendEmail = await this.mailService.sendMail(normalizedEmail, otp);
|
||||
|
||||
if (sendEmail) {
|
||||
const hashOtp = await this.hashService.hash(otp);
|
||||
|
||||
await dbServiceToUpdate.findOneAndUpdate(filter, { otp: hashOtp });
|
||||
|
||||
return sendEmail;
|
||||
} else {
|
||||
throw new BadGatewayException("mailServer in unavailable");
|
||||
}
|
||||
// Mailer disabled – not used
|
||||
// const sendEmail = await this.mailService.sendMail(normalizedEmail, otp);
|
||||
// if (sendEmail) {
|
||||
const hashOtp = await this.hashService.hash(otp);
|
||||
await dbServiceToUpdate.findOneAndUpdate(filter, { otp: hashOtp });
|
||||
return {
|
||||
message: "OTP generated (mail sending disabled)",
|
||||
code: 200,
|
||||
emailSent: false,
|
||||
};
|
||||
// } else {
|
||||
// throw new BadGatewayException("mailServer in unavailable");
|
||||
// }
|
||||
}
|
||||
|
||||
async forgetPasswordVerify(email, otp, newPassword) {
|
||||
|
||||
Reference in New Issue
Block a user