listo tipo usuario

This commit is contained in:
xXpuma99Xx
2022-10-24 15:26:46 -05:00
parent 1547750243
commit 3d498affe9
+3
View File
@@ -14,11 +14,14 @@ export class TipoUsuarioService {
) {}
create(tipo_usuario: string) {
// Busco un tipo de usuario con ese nombre
return this.repository
.findOne({ where: { tipo_usuario } })
.then((existeTipoUsuario) => {
// Saco error si existe
if (existeTipoUsuario)
throw new ConflictException('Ya existe este tipo usuario');
// Creo y guardo el registro
return this.repository.save(this.repository.create({ tipo_usuario }));
})
.then((_) => ({