Files
api/src/controller/usuario/create.js
T
2020-10-02 11:55:27 -05:00

40 lines
974 B
JavaScript

require('../../config/config')
const bcrypt = require('bcrypt')
const Usuario = require('../../db/tables/Usuario')
const create = (body) => {
return Usuario.create({
idUsuario: body.idUsuario,
password: bcrypt.hashSync(body.password, Number(process.env.SALT_ROUNDS)),
nombre: body.nombre,
apPaterno: body.apPaterno,
apMaterno: body.apMaterno,
correo: body.correo,
telefono: body.telefono,
identificacion: '',
foto: '',
idTipoUsuario: 2,
idCarreraPlantel: body.idCarreraPlantel,
})
.then((res) => {
console.log(res)
return { mensaje: 'Se creo un usuario correctamente' }
})
.catch((err) => {
throw new Error(err)
})
}
module.exports = create
// create({
// idUsuario: '316313528',
// password: 'hola',
// nombre: 'Lemuel Helon',
// apPaterno: 'Márquez',
// apMaterno: 'Rosas',
// correo: 'lemuel@acatlan.unam.mx',
// telefono: '5514054674',
// idCarreraPlantel: 163,
// })