terminada v2
This commit is contained in:
@@ -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(
|
||||
|
||||
@@ -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 = [];
|
||||
|
||||
Reference in New Issue
Block a user