chore: compelete danak category service

This commit is contained in:
mahyargdz
2025-01-26 16:10:12 +03:30
parent e4425a07d6
commit bdd8ec06b4
17 changed files with 367 additions and 16 deletions
+4 -1
View File
@@ -98,11 +98,14 @@ export class AuthService {
}
//****************** */
async requestLoginOtp(requestOtpDto: RequestOtpDto) {
async requestLoginOtp(requestOtpDto: RequestOtpDto, isAdmin: boolean = false) {
const { phone } = requestOtpDto;
const user = await this.usersService.findOneWithPhone(phone);
if (!user) throw new BadRequestException(AuthMessage.PHONE_NOT_FOUND);
//check the if the method call is from admin or not
if (isAdmin && user.role.name !== RoleEnum.ADMIN) throw new BadRequestException(AuthMessage.NOT_ADMIN);
const existCode = await this.otpService.checkExistOtp(phone, "LOGIN");
if (existCode) {
return {