mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-11-27 02:34:55 +00:00
Add RoleService to AuthModule and UserAuthService
This commit is contained in:
@ -18,6 +18,8 @@ import * as argon2 from 'argon2';
|
||||
import { differenceInSeconds } from '@app/common/helper/differenceInSeconds';
|
||||
import { LessThan, MoreThan } from 'typeorm';
|
||||
import { ConfigService } from '@nestjs/config';
|
||||
import { RoleService } from 'src/role/services';
|
||||
import { RoleType } from '@app/common/constants/role.type.enum';
|
||||
|
||||
@Injectable()
|
||||
export class UserAuthService {
|
||||
@ -28,6 +30,7 @@ export class UserAuthService {
|
||||
private readonly helperHashService: HelperHashService,
|
||||
private readonly authService: AuthService,
|
||||
private readonly emailService: EmailService,
|
||||
private readonly roleService: RoleService,
|
||||
private readonly configService: ConfigService,
|
||||
) {}
|
||||
|
||||
@ -44,9 +47,13 @@ export class UserAuthService {
|
||||
|
||||
try {
|
||||
const { regionUuid, ...rest } = userSignUpDto;
|
||||
const spaceMemberRole = await this.roleService.findRoleByType(
|
||||
RoleType.SPACE_MEMBER,
|
||||
);
|
||||
const user = await this.userRepository.save({
|
||||
...rest,
|
||||
password: hashedPassword,
|
||||
roleType: { uuid: spaceMemberRole.uuid },
|
||||
region: regionUuid
|
||||
? {
|
||||
uuid: regionUuid,
|
||||
|
||||
Reference in New Issue
Block a user