diff --git a/modules/events/event.controller.js b/modules/events/event.controller.js index 58df6bf..658421d 100644 --- a/modules/events/event.controller.js +++ b/modules/events/event.controller.js @@ -352,11 +352,13 @@ console.log('actualizo confirmados de la nueva reserva'); null) else return handleResultResponse("No se ha podido actualizar el aforo de la reserva", null, params, res, httpStatus.NOT_FOUND); - } - //Ponemos la reserva en SOLD_OUT y abrimos la lista de espera si se puede + //Ponemos la reserva en SOLD_OUT para que no se pueda apuntar nadie más + if (dataInscription.reservation.assistants == dataInscription.inscriptionsWithReservationCount) + await eventReservationService._updateSoldOutReservation(dataInscription.reservation.id, true); + } + // APUNTARSE A LISTA DE ESPERA SI SE PUEDE else { - await eventReservationService._updateSoldOutReservation(dataInscription.reservation.id, true); if (dataInscription.reservation.allow_overflow === true) { dataInscription.validated = false; dataInscription.inscriptionsWithReservationCount = await eventInscriptionService._getCountInscriptionsWithReservation(dataInscription.reservation.overflow_reservationId); @@ -399,10 +401,13 @@ console.log('actualizo confirmados de la nueva reserva'); null) else return handleResultResponse("No se ha podido actualizar el aforo del evento", null, params, res, httpStatus.NOT_FOUND); + + //Ponemos el evento en SOLD_OUT + if (dataInscription.event.assistants == dataInscription.inscriptionsWithoutReservationCount) + await eventService._updateSoldOutEvent(dataInscription.event.id, true); } - //Ponemos el evento en SOLD_OUT y abrimos la lista de espera si se puede + // APUNTARSE A la lista de espera si se puede else { - await eventService._updateSoldOutEvent(dataInscription.event.id, true); if (dataInscription.event.allow_overflow === true) { dataInscription.validated = false; diff --git a/modules/events/event.routes.js b/modules/events/event.routes.js index 7016c88..b2388f9 100644 --- a/modules/events/event.routes.js +++ b/modules/events/event.routes.js @@ -18,7 +18,7 @@ const generalInvalidFields = [ 'userId', 'createdAt', 'updatedAt', 'assistants', 'confirmed', 'allow_multiple', 'overflow_eventId', 'state', 'confirmed', - 'multiple_limit', 'allow_overflow', 'marketing_list', + 'multiple_limit', 'marketing_list', ]; routes.get('/events',