refactor delete user endpoint

This commit is contained in:
faris Aljohari
2024-09-30 02:10:41 -05:00
parent a3cce2b21c
commit 2b9788eff7
4 changed files with 26 additions and 28 deletions
-12
View File
@@ -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 } });
}