ya no deberían haber duplicados
This commit is contained in:
@@ -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.',
|
||||
}));
|
||||
};
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user