terminada v2

This commit is contained in:
2022-05-17 20:57:26 -05:00
parent b03c77658a
commit 75fe6858de
3 changed files with 5 additions and 4 deletions
@@ -1,8 +1,8 @@
const Premiacion = require('../../db/tablas/Premiacion');
const { validarNumeroEntero, validarFecha } = require('../../helper/validar');
const { validarNumeroEntero } = require('../../helper/validar');
const activarDesactivar = async (body) => {
if (!body.activa)
if (typeof body.activa === "undefined")
throw new Error('Se necesita saber si se quiere activar o desactivar.');
const idPremiacion = validarNumeroEntero(
+3 -1
View File
@@ -2,6 +2,8 @@ const Premiacion = require('../../db/tablas/Premiacion');
const { validarNumeroEntero, validarFecha } = require('../../helper/validar');
const editar = async (body) => {
if (!body.fecha && !body.hora)
throw new Error('Hay que enviar una fecha u hora nueva.');
let fecha;
let hora;
if (body.fecha) fecha = validarFecha(body.fecha);
@@ -15,7 +17,7 @@ const editar = async (body) => {
const premiacion = await Premiacion.findOne({ where: idPremiacion });
if (!premiacion) throw new Error('No existe esta premiación.');
return premiacion.update({ fecha, hora});
return premiacion.update({ fecha, hora });
};
module.exports = editar;
@@ -5,7 +5,6 @@ const { validarNumeroEntero } = require('../../helper/validar');
const ProfesorPremiacion = require('../../db/tablas/profesorPremiacion');
const cargaMasiva = async (file, body) => {
console.log(body)
const idPremiacion = validarNumeroEntero(body.idPremiacion);
const path = `server/uploads/${file}`;
let res = [];