21 lines
490 B
JavaScript
21 lines
490 B
JavaScript
const dbPath = '../../db/tablas';
|
|
const Usuario = require(`${dbPath}/Usuario`);
|
|
const { validarNumeroCuenta } = require('../../helper/validar');
|
|
|
|
const credito = async (body) => {
|
|
const numeroCuenta = validarNumeroCuenta(
|
|
body.numeroCuenta,
|
|
'número de cuenta',
|
|
true
|
|
);
|
|
return Usuario.findOne({
|
|
where: { numeroCuenta },
|
|
}).then(() => {
|
|
return Usuario.findOne({
|
|
attributes: ['credito', 'nombre', 'numeroCuenta'],
|
|
});
|
|
});
|
|
};
|
|
|
|
module.exports = credito;
|