48 lines
1.1 KiB
JavaScript
48 lines
1.1 KiB
JavaScript
const { validarNumeroEntero } = require('../../helper/validar');
|
|
const dbPath = '../../db/tablas';
|
|
const Carrera = require(`${dbPath}/Carrera`);
|
|
const CasoEspecial = require(`${dbPath}/CasoEspecial`);
|
|
const Status = require(`${dbPath}/Status`);
|
|
const TipoUsuario = require(`${dbPath}/TipoUsuario`);
|
|
const Usuario = require(`${dbPath}/Usuario`);
|
|
|
|
const admin = async (body) => {
|
|
const idCasoEspecial = validarNumeroEntero(
|
|
body.idCasoEspecial,
|
|
'id caso especial'
|
|
);
|
|
|
|
return CasoEspecial.findOne({
|
|
where: { idCasoEspecial },
|
|
include: [
|
|
{
|
|
model: Usuario,
|
|
include: [{ model: TipoUsuario }],
|
|
attributes: ['idUsuario', 'usuario', 'nombre'],
|
|
},
|
|
{ model: Carrera },
|
|
{ model: Status },
|
|
],
|
|
attributes: [
|
|
'idCasoEspecial',
|
|
'creditos',
|
|
'correo',
|
|
'telefono',
|
|
'institucion',
|
|
'dependencia',
|
|
'motivo',
|
|
'direccion',
|
|
'fechaInicio',
|
|
'fechaFin',
|
|
'fechaNacimiento',
|
|
'archivoZip',
|
|
'createdAt',
|
|
],
|
|
}).then((res) => {
|
|
if (!res) throw new Error('No existe este Caso Especial.');
|
|
return res;
|
|
});
|
|
};
|
|
|
|
module.exports = admin;
|