rutas iniciales
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
const Equipo = require('../../db/tables/Equipo')
|
||||
|
||||
const get = async (body) => {
|
||||
return Equipo.findOne({ where: { idEquipo: body.idEquipo } })
|
||||
.then((res) => {
|
||||
return res
|
||||
})
|
||||
.catch((err) => {})
|
||||
}
|
||||
|
||||
module.exports = get
|
||||
@@ -26,7 +26,7 @@ const create = (body) => {
|
||||
module.exports = create
|
||||
|
||||
// create({
|
||||
// idUsuario: '316313528',
|
||||
// idUsuario: 316313528,
|
||||
// password: 'hola',
|
||||
// nombre: 'Lemuel Helon',
|
||||
// apPaterno: 'Márquez',
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
const Usuario = require('../../db/tables/Usuario')
|
||||
|
||||
const get = async (body) => {
|
||||
console.log(body)
|
||||
return Usuario.findAll({ where: { idUsuario: body.idUsuario } })
|
||||
.then((res) => {
|
||||
return res
|
||||
|
||||
@@ -2,16 +2,19 @@ const bcrypt = require('bcrypt')
|
||||
const Usuario = require('../../db/tables/Usuario')
|
||||
|
||||
const login = (body) => {
|
||||
return Usuario.findOne({ where: { idUsuario: body.idUsuario } })
|
||||
.then((res) => {
|
||||
return Usuario.findOne({ where: { idUsuario: body.idUsuario } }).then(
|
||||
(res) => {
|
||||
if (res) {
|
||||
if (!bcrypt.compareSync(body.password, res.password))
|
||||
throw new Error('El usuario o contraseña son incorrectos.')
|
||||
return { res }
|
||||
}
|
||||
throw new Error('El usuario o contraseña son incorrectos.')
|
||||
})
|
||||
.catch((err) => {})
|
||||
}
|
||||
)
|
||||
// .catch((err) => {
|
||||
// console.log(err)
|
||||
// })
|
||||
}
|
||||
|
||||
module.exports = login
|
||||
|
||||
Reference in New Issue
Block a user