mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-11-26 10:54:55 +00:00
Remove USER role
This commit is contained in:
@ -50,15 +50,6 @@ export class UserAuthService {
|
||||
password: hashedPassword,
|
||||
});
|
||||
|
||||
const defaultUserRoleUuid = await this.getRoleUuidByRoleType(
|
||||
RoleType.USER,
|
||||
);
|
||||
|
||||
await this.userRoleRepository.save({
|
||||
user: { uuid: user.uuid },
|
||||
roleType: { uuid: defaultUserRoleUuid },
|
||||
});
|
||||
|
||||
return user;
|
||||
} catch (error) {
|
||||
throw new BadRequestException('Failed to register user');
|
||||
@ -114,7 +105,7 @@ export class UserAuthService {
|
||||
email: user.email,
|
||||
userId: user.uuid,
|
||||
uuid: user.uuid,
|
||||
roles: user.role.map((role) => {
|
||||
roles: user?.roles?.map((role) => {
|
||||
return { uuid: role.uuid, type: role.roleType.type };
|
||||
}),
|
||||
sessionId: session[1].uuid,
|
||||
@ -214,11 +205,4 @@ export class UserAuthService {
|
||||
await this.authService.updateRefreshToken(user.uuid, tokens.refreshToken);
|
||||
return tokens;
|
||||
}
|
||||
private async getRoleUuidByRoleType(roleType: string) {
|
||||
const role = await this.roleTypeRepository.findOne({
|
||||
where: { type: roleType },
|
||||
});
|
||||
|
||||
return role.uuid;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user