fechas en db
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user