ya no deberían haber duplicados

This commit is contained in:
2022-10-14 12:16:24 -05:00
parent 0aa406fb15
commit 6c1d967c8c
3 changed files with 60 additions and 28 deletions
+1 -1
View File
@@ -36,7 +36,7 @@ const liberacion = async (body) => {
.then((res) => CasoEspecial.update(update, { where: { idCasoEspecial } }))
.then((res) => ({
message:
'Se cambio de estatus correctamente y se envio un correo al alumno informandole de su liberación.',
'Se cambió de estatus correctamente y se envió un correo al alumno informandole de su liberación.',
}));
};
+31 -21
View File
@@ -41,7 +41,6 @@ const nuevo = async (body, file) => {
const profesor = body.profesor
? validar.validarTexto(body.profesor, 'profesor', true, 50)
: '';
let carpeta = '';
return Usuario.findOne({
where: { idUsuario },
@@ -65,19 +64,7 @@ const nuevo = async (body, file) => {
.then(async (res) => {
if (res)
throw new Error('Este alumno ya tienen un Servicio Social activo.');
return drive.folder(numeroCuenta);
})
.then((res) => {
carpeta = res;
return drive.uploadFile(
path,
`Carta_Aceptacion.pdf`,
'application/pdf',
carpeta
);
})
.then((res) =>
Servicio.create({
return Servicio.create({
idUsuario,
idPrograma,
idCarrera,
@@ -85,15 +72,38 @@ const nuevo = async (body, file) => {
correo,
fechaInicio: fechaInicio.format(),
fechaFin: fechaFin.format(),
carpeta,
cartaAceptacion: res,
carpeta: '',
cartaAceptacion: '',
profesor,
programaInterno,
})
)
.then((res) => ({
message: `Se Pre-Registro correctamente a este alumno alumno.`,
}));
});
})
.then((servicio) => {
let carpeta = '';
drive
.folder(numeroCuenta)
.then((res) => {
carpeta = res;
return drive.uploadFile(
path,
`Carta_Aceptacion.pdf`,
'application/pdf',
carpeta
);
})
.then((res) =>
Servicio.update(
{ carpeta, cartaAceptacion: res },
{ where: { idServicio: servicio.idServicio } }
)
)
.then((res) => {
console.log(res);
console.log("Se subió el archivo");
});
return { message: `Se Pre-Registro correctamente a este alumno alumno.` };
});
};
module.exports = nuevo;