@Patch idactivo

This commit is contained in:
2026-03-05 14:41:19 -05:00
parent 81ad881d6a
commit 3bb95a3d50
2 changed files with 22 additions and 0 deletions
+16
View File
@@ -20,6 +20,22 @@ export class UserService {
private perfilRepository: Repository<Perfil>,
private jwtService: JwtService,
) {}
async toggleActivo(id: number) {
const usuario = await this.userRepository.findOne({
where: { id_usuario: id }
});
if(!usuario){
throw new NotFoundException("no se encontro usuario")
}
usuario.activo = usuario.activo === 1 ? 0 : 1;
return this.userRepository.save(usuario);
}
async getactive(id: number) {