reduccion de lineas de codigo
This commit is contained in:
@@ -13,52 +13,26 @@ const alumno = async (body) => {
|
||||
.then((res) => {
|
||||
if (!res) throw new Error('No existe este usuario.');
|
||||
if (res.idTipoUsuario !== 3)
|
||||
throw new Error('No es un usuaior de tipo alumno.');
|
||||
throw new Error('No es un usuario de tipo alumno.');
|
||||
return Servicio.findOne({
|
||||
where: { idUsuario, idStatus: { [Op.not]: 10 } },
|
||||
include: [
|
||||
{ model: Usuario },
|
||||
{ model: Carrera },
|
||||
{ model: Status },
|
||||
{ model: Programa },
|
||||
],
|
||||
include: [{ model: Carrera }, { model: Status }, { model: Programa }],
|
||||
});
|
||||
})
|
||||
.then((res) => {
|
||||
if (!res) throw new Error('No existe este servicio social.');
|
||||
return {
|
||||
idServicio: res.idServicio,
|
||||
creditos: res.creditos,
|
||||
correo: res.correo,
|
||||
telefono: res.telefono,
|
||||
direccion: res.direccion,
|
||||
fechaInicio: res.fechaInicio,
|
||||
fechaFin: res.fechaFin,
|
||||
fechaNacimiento: res.fechaNacimiento,
|
||||
informeGlobal: res.informeGlobal,
|
||||
programaInterno: res.programaInterno,
|
||||
profesor: res.profesor,
|
||||
createdAt: res.createdAt,
|
||||
updatedAt: res.updatedAt,
|
||||
idCuestionarioAlumno: res.idCuestionarioAlumno,
|
||||
Carrera: {
|
||||
idCarrera: res.Carrera.idCarrera,
|
||||
carrera: res.Carrera.carrera,
|
||||
},
|
||||
Status: {
|
||||
idStatus: res.Status.idStatus,
|
||||
status: res.Status.status,
|
||||
},
|
||||
Programa: {
|
||||
idPrograma: res.Programa.idPrograma,
|
||||
institucion: res.Programa.institucion,
|
||||
dependencia: res.Programa.dependencia,
|
||||
programa: res.Programa.programa,
|
||||
clavePrograma: res.Programa.clavePrograma,
|
||||
acatlan: res.Programa.acatlan,
|
||||
activo: res.Programa.activo,
|
||||
},
|
||||
};
|
||||
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