fechas en db
This commit is contained in:
@@ -35,6 +35,8 @@ const admin = (body) => {
|
||||
programaInterno: res.programaInterno,
|
||||
profesor: res.profesor,
|
||||
vistoBuenoAcatlan: res.vistoBuenoAcatlan,
|
||||
createdAt: res.createdAt,
|
||||
updatedAt: res.updatedAt,
|
||||
idCuestionarioAlumno: res.idCuestionarioAlumno,
|
||||
idCuestionarioPrograma: res.idCuestionarioPrograma,
|
||||
Usuario: {
|
||||
|
||||
@@ -41,6 +41,8 @@ const alumno = async (body) => {
|
||||
programaInterno: res.programaInterno,
|
||||
profesor: res.profesor,
|
||||
vistoBuenoAcatlan: res.vistoBuenoAcatlan,
|
||||
createdAt: res.createdAt,
|
||||
updatedAt: res.updatedAt,
|
||||
idCuestionarioAlumno: res.idCuestionarioAlumno,
|
||||
idCuestionarioPrograma: res.idCuestionarioPrograma,
|
||||
Carrera: {
|
||||
|
||||
@@ -12,7 +12,7 @@ const cancelar = async (body) => {
|
||||
return Servicio.update({ idStatus: 10 }, { where: { idServicio } });
|
||||
})
|
||||
.then((res) => {
|
||||
return { message: 'Se cancelo correctamente el servicio.' };
|
||||
return { message: 'Se cancelo correctamente este Servicio Social.' };
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -10,13 +10,21 @@ const nuevo = async (body, file) => {
|
||||
let idUsuario = validar.validarId(body.idUsuario);
|
||||
let idPrograma = validar.validarId(body.idPrograma);
|
||||
let idCarrera = validar.validarId(body.idCarrera);
|
||||
let numeroCuenta = validar.validarNumeroCuenta(body.numeroCuenta);
|
||||
let creditos = validar.validarNumero(body.creditos);
|
||||
let correo = validar.validarCorreo(body.correo);
|
||||
let fechaInicio = validar.validarFecha(body.fechaInicio);
|
||||
let fechaFin = validar.validarFecha(body.fechaFin);
|
||||
let path = `./server/uploads/${validar.validar(file, 'El archivo')}`;
|
||||
let carpeta = '';
|
||||
let cartaAceptacion = '';
|
||||
|
||||
return Usuario.findOne({
|
||||
where: { idUsuario },
|
||||
})
|
||||
.then((res) => {
|
||||
if (!res) throw new Error('Este alumno no existe en la db.');
|
||||
if (res.idTipoUsuario === 3)
|
||||
if (res.idTipoUsuario !== 3)
|
||||
throw new Error('Este usuario no es de tipo Alumno.');
|
||||
return Programa.findOne({ where: { idPrograma } });
|
||||
})
|
||||
@@ -33,21 +41,19 @@ const nuevo = async (body, file) => {
|
||||
.then(async (res) => {
|
||||
if (res)
|
||||
throw new Error('Este alumno ya tienen un Servicio Social activo.');
|
||||
|
||||
let numeroCuenta = validar.validarNumeroCuenta(body.numeroCuenta);
|
||||
let creditos = validar.validarNumero(body.creditos);
|
||||
let correo = validar.validarCorreo(body.correo);
|
||||
let fechaInicio = validar.validarFecha(body.fechaInicio);
|
||||
let fechaFin = validar.validarFecha(body.fechaFin);
|
||||
let carpeta = await drive.folder(numeroCuenta);
|
||||
let path = `./server/uploads/${validar.validar(file, 'El archivo')}`;
|
||||
let cartaAceptacion = await drive.uploadFile(
|
||||
return drive.folder(numeroCuenta);
|
||||
})
|
||||
.then((res) => {
|
||||
carpeta = res;
|
||||
return drive.uploadFile(
|
||||
path,
|
||||
`Carta_Aceptacion.pdf`,
|
||||
'application/pdf',
|
||||
carpeta
|
||||
);
|
||||
|
||||
})
|
||||
.then((res) => {
|
||||
cartaAceptacion = res;
|
||||
return Servicio.create({
|
||||
idUsuario,
|
||||
idPrograma,
|
||||
|
||||
@@ -68,7 +68,7 @@ const registroValidado = async (body) => {
|
||||
.then((res) => {
|
||||
return {
|
||||
message:
|
||||
'Se cambio de estatus correctamente y se envio un correo al alumno y al responsable de programa.',
|
||||
'Haz terminado el registro de tu Servicio Social correctamente.',
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user