auth
This commit is contained in:
@@ -26,7 +26,7 @@ export class AuthService {
|
|||||||
private readonly notificationQueue: NotificationQueue,
|
private readonly notificationQueue: NotificationQueue,
|
||||||
private readonly smsService: SmsService,
|
private readonly smsService: SmsService,
|
||||||
private readonly em: EntityManager,
|
private readonly em: EntityManager,
|
||||||
) {}
|
) { }
|
||||||
//****************** */
|
//****************** */
|
||||||
//****************** */
|
//****************** */
|
||||||
async initiateRegistration(requestOtpDto: RequestOtpDto, businessId: string) {
|
async initiateRegistration(requestOtpDto: RequestOtpDto, businessId: string) {
|
||||||
@@ -140,9 +140,9 @@ export class AuthService {
|
|||||||
const otpCode = await this.otpService.generateAndSetInCache(phone, "LOGIN");
|
const otpCode = await this.otpService.generateAndSetInCache(phone, "LOGIN");
|
||||||
//
|
//
|
||||||
await this.smsService.sendSmsVerifyCode(phone, otpCode);
|
await this.smsService.sendSmsVerifyCode(phone, otpCode);
|
||||||
|
// TODO : remove otp
|
||||||
return {
|
return {
|
||||||
message: AuthMessage.OTP_SENT,
|
message: AuthMessage.OTP_SENT + otpCode,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,19 @@ export class BarnameService {
|
|||||||
if (!company) throw new BadRequestException(CompanyMessage.COMPANY_NOT_FOUND);
|
if (!company) throw new BadRequestException(CompanyMessage.COMPANY_NOT_FOUND);
|
||||||
|
|
||||||
const bill = this.em.create(Barname,
|
const bill = this.em.create(Barname,
|
||||||
{ carType, exitAt, origin, plaque, business, description, driverName, driverPhone, company, attachments });
|
{
|
||||||
|
carType,
|
||||||
|
exitAt,
|
||||||
|
origin,
|
||||||
|
plaque,
|
||||||
|
business,
|
||||||
|
description,
|
||||||
|
driverName,
|
||||||
|
driverPhone,
|
||||||
|
company,
|
||||||
|
attachments,
|
||||||
|
status: BarnameStatus.PENDING
|
||||||
|
});
|
||||||
|
|
||||||
await this.em.persistAndFlush(bill);
|
await this.em.persistAndFlush(bill);
|
||||||
|
|
||||||
@@ -41,7 +53,7 @@ export class BarnameService {
|
|||||||
|
|
||||||
async updateBarnameAsWatcher(id: string, dto: UpdateBarnameAsWatcherDto, business: Business, role: RoleEnum) {
|
async updateBarnameAsWatcher(id: string, dto: UpdateBarnameAsWatcherDto, business: Business, role: RoleEnum) {
|
||||||
|
|
||||||
if(role != RoleEnum.WATCHER){
|
if (role != RoleEnum.WATCHER) {
|
||||||
throw new ForbiddenException("you are not allowed")
|
throw new ForbiddenException("you are not allowed")
|
||||||
}
|
}
|
||||||
const { exitedAt, watcherDescription } = dto;
|
const { exitedAt, watcherDescription } = dto;
|
||||||
|
|||||||
Reference in New Issue
Block a user