listo tipo usuario
This commit is contained in:
@@ -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((_) => ({
|
||||
|
||||
Reference in New Issue
Block a user