sms logging in mongo part was added

This commit is contained in:
2026-08-08 12:14:31 +03:30
parent e6038c73c5
commit 07d6cdbe7c
11 changed files with 541 additions and 6 deletions

View File

@@ -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(