Se agregó endpoint para crear usuarios admin
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
const helperPath = '../../helper';
|
||||
const encriptar = require(`${helperPath}/encriptar`);
|
||||
const dbPath = '../../db/tablas';
|
||||
const Usuario = require(`${dbPath}/Usuario`);
|
||||
|
||||
const newAdmin = async (body) => {
|
||||
const password = encriptar.generarPassword();
|
||||
|
||||
|
||||
await Usuario.create({
|
||||
usuario: body.usuario,
|
||||
password: encriptar.encriptar(password),
|
||||
nombre: body.nombre,
|
||||
activo: true,
|
||||
idTipoUsuario: 1,
|
||||
})
|
||||
return password;
|
||||
};
|
||||
|
||||
module.exports = newPasswordAlumno;
|
||||
Reference in New Issue
Block a user