sms-setting and campain

This commit is contained in:
2026-07-09 19:12:23 +03:30
parent 1dd2813a01
commit ffb95149cf
33 changed files with 2745 additions and 6 deletions
+11 -3
View File
@@ -15,7 +15,8 @@ import { Repository, IsNull } from 'typeorm';
import { Customer } from '../customers/entities/customer.entity';
import { Salon } from '../salons/entities/salon.entity';
import { ProvincesService } from '../provinces/provinces.service';
import { SmsService } from '../sms/sms.service';
import { SmsDispatchService } from '../sms-settings/sms-dispatch.service';
import { SmsScenarioKey } from '../sms-settings/enums/sms-scenario-key.enum';
import { SalonSubscription } from '../subscriptions/entities/salon-subscription.entity';
import { SalonSubscriptionsService } from '../subscriptions/salon-subscriptions.service';
import { UserRole } from '../users/enums/user-role.enum';
@@ -73,7 +74,7 @@ export class AuthService {
private readonly provincesService: ProvincesService,
private readonly usersService: UsersService,
private readonly salonSubscriptionsService: SalonSubscriptionsService,
private readonly smsService: SmsService,
private readonly smsDispatchService: SmsDispatchService,
private readonly jwtService: JwtService,
private readonly configService: ConfigService,
) {
@@ -193,7 +194,14 @@ export class AuthService {
expiresAt,
});
const sent = await this.smsService.sendSms(mobile, `کد ورود: ${code}`);
const sent = await this.smsDispatchService.sendScenarioSms(
SmsScenarioKey.OTP_LOGIN,
mobile,
{
code,
expiresInMinutes: String(expiresInMinutes),
},
);
if (!sent && !this.shouldExposeOtpInResponse()) {
throw new BadRequestException('Failed to send OTP');