forked from Yara724/api
sms logging in mongo part was added
This commit is contained in:
@@ -19,6 +19,7 @@ import {
|
||||
readOtpExpireMinutesFromEnv,
|
||||
} from "src/helpers/user-otp-expiry";
|
||||
import { OtpGeneratorService } from "src/sms-orchestration/otp-generator.service";
|
||||
import { SmsSendLogService } from "src/sms-orchestration/entities/db-service/sms-send-log.service";
|
||||
import { UserDbService } from "src/users/entities/db-service/user.db.service";
|
||||
import { SmsOrchestrationService } from "src/sms-orchestration/sms-orchestration.service";
|
||||
import { HashService } from "src/utils/hash/hash.service";
|
||||
@@ -38,6 +39,7 @@ export class UserAuthService {
|
||||
private readonly hashService: HashService,
|
||||
private readonly otpCreator: OtpGeneratorService,
|
||||
private readonly smsOrchestrationService: SmsOrchestrationService,
|
||||
private readonly smsSendLogService: SmsSendLogService,
|
||||
private readonly userLinkAccessService: UserLinkAccessService,
|
||||
) {}
|
||||
|
||||
@@ -175,6 +177,10 @@ export class UserAuthService {
|
||||
this.logger.log(
|
||||
`FAKE_OTP=true — skipped SMS for phone=${mobile} (use OTP ${FAKE_OTP_CODE})`,
|
||||
);
|
||||
await this.smsSendLogService.recordSkippedOtp({
|
||||
receptor: mobile,
|
||||
otp: FAKE_OTP_CODE,
|
||||
});
|
||||
return;
|
||||
}
|
||||
const ok = await this.smsOrchestrationService.sendAuthOtp(
|
||||
|
||||
Reference in New Issue
Block a user