querries traen solo lo que necesitan
This commit is contained in:
@@ -17,22 +17,40 @@ const alumno = async (body) => {
|
||||
throw new Error('No es un usuario de tipo alumno.');
|
||||
return Servicio.findOne({
|
||||
where: { idUsuario, idStatus: { [Op.not]: 10 } },
|
||||
include: [{ model: Carrera }, { model: Status }, { model: Programa }],
|
||||
include: [
|
||||
{ model: Carrera },
|
||||
{ model: Status },
|
||||
{
|
||||
model: Programa,
|
||||
attributes: [
|
||||
'idPrograma',
|
||||
'institucion',
|
||||
'dependencia',
|
||||
'programa',
|
||||
'clavePrograma',
|
||||
],
|
||||
},
|
||||
],
|
||||
attributes: [
|
||||
'idServicio',
|
||||
'creditos',
|
||||
'correo',
|
||||
'telefono',
|
||||
'direccion',
|
||||
'fechaInicio',
|
||||
'fechaFin',
|
||||
'fechaLiberacion',
|
||||
'fechaNacimiento',
|
||||
'informeGlobal',
|
||||
'programaInterno',
|
||||
'profesor',
|
||||
'createdAt',
|
||||
'idCuestionarioAlumno',
|
||||
],
|
||||
});
|
||||
})
|
||||
.then((res) => {
|
||||
if (!res) throw new Error('No existe este servicio social.');
|
||||
delete res.dataValues.idUsuario;
|
||||
delete res.dataValues.idCarrera;
|
||||
delete res.dataValues.idStatus;
|
||||
delete res.dataValues.idPrograma;
|
||||
delete res.dataValues.updatedAt;
|
||||
delete res.dataValues.carpeta;
|
||||
delete res.dataValues.cartaAceptacion;
|
||||
delete res.dataValues.cartaTermino;
|
||||
delete res.dataValues.vistoBuenoAcatlan;
|
||||
delete res.dataValues.idCuestionarioPrograma;
|
||||
delete res.dataValues.Programa.idUsuario;
|
||||
return res;
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user