mirror of
https://github.com/SyncrowIOT/backend.git
synced 2026-10-24 06:27:55 +00:00
refactor delete user endpoint
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
import { RoleTypeRepository } from './../../../libs/common/src/modules/role-type/repositories/role.type.repository';
|
||||
import { UserRoleRepository } from './../../../libs/common/src/modules/user/repositories/user.repository';
|
||||
import { UserRepository } from '../../../libs/common/src/modules/user/repositories';
|
||||
import {
|
||||
BadRequestException,
|
||||
@@ -31,8 +29,6 @@ export class UserAuthService {
|
||||
private readonly helperHashService: HelperHashService,
|
||||
private readonly authService: AuthService,
|
||||
private readonly emailService: EmailService,
|
||||
private readonly userRoleRepository: UserRoleRepository,
|
||||
private readonly roleTypeRepository: RoleTypeRepository,
|
||||
private readonly configService: ConfigService,
|
||||
) {}
|
||||
|
||||
@@ -128,14 +124,6 @@ export class UserAuthService {
|
||||
}
|
||||
}
|
||||
|
||||
async deleteUser(uuid: string) {
|
||||
const user = await this.findOneById(uuid);
|
||||
if (!user) {
|
||||
throw new BadRequestException('User not found');
|
||||
}
|
||||
return await this.userRepository.update({ uuid }, { isActive: false });
|
||||
}
|
||||
|
||||
async findOneById(id: string): Promise<UserEntity> {
|
||||
return await this.userRepository.findOne({ where: { uuid: id } });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user