diff --git a/modules/events/event.controller.js b/modules/events/event.controller.js index 6edbba2..5d0edf2 100644 --- a/modules/events/event.controller.js +++ b/modules/events/event.controller.js @@ -71,7 +71,6 @@ const extraControllers = { allow: false, error: undefined, }; - console.log(">>>>>>>>>>>>>>>>>>>>>>>checkCapacity"); if (!result.eventId) { return handleResultResponse(null, null, params, res, httpStatus.BAD_REQUEST); @@ -93,9 +92,6 @@ const extraControllers = { if (Event.overflow_eventId && Event.allow_overflow) EventOverflow = await eventService._getEvent(Event.overflow_eventId); - console.log(">>>>>>>>>>>>>>>>>>>>>>>Event.sold_out: ", Event.sold_out); - console.log(">>>>>>>>>>>>>>>>>>>>>>>EventOverflow.sold_out: ", EventOverflow.sold_out); - result = Object.assign({}, result, { allow: (Event.sold_out) ? false : Event.assistants - Event.confirmed >= result.group_size, assistants: Event.assistants, @@ -108,8 +104,6 @@ const extraControllers = { }); } - console.log(">>>>>>>>>>>>>>>>>>>>>>>checkCapacity", result); - return handleResultResponse(result, null, params, res, result === null ? httpStatus.NOT_FOUND : httpStatus.OK); } catch (error) { return handleErrorResponse(MODULE_NAME, "allowCapacity", error, res); diff --git a/modules/events/event.routes.v4.js b/modules/events/event.routes.v4.js index 950afd4..5160809 100644 --- a/modules/events/event.routes.v4.js +++ b/modules/events/event.routes.v4.js @@ -169,17 +169,17 @@ routes.get( ); /** - * @api {get} /api/v4/web/events/:id/check_capacity Verificar Capacidad del Evento + * @api {get} /api/v4/web/events/:id/check_capacity?group_size=xx Verificar Capacidad del Evento * @apiName CheckEventCapacity * @apiGroup Eventos * @apiVersion 1.0.0 * @apiDescription Determina si hay aforo suficiente para el tamaño de grupo que se ha indicado. * * @apiParam {String} id ID único del evento. + * @apiParam {String} group_size número de entradas solicitadas para evento el evento. * * @apiSuccess {String} eventId ID único del evento. * @apiSuccess {Number} group_size Tamaño del grupo para el cual se verifica el aforo. - * @apiSuccess {Boolean} allow Indica si el aforo es suficiente para el grupo. * @apiSuccess {Number} assistants Número total de asistentes permitidos. * @apiSuccess {Number} confirmed Número de asistentes confirmados. * @apiSuccess {Boolean} sold_out Indica si el evento está completamente lleno. @@ -193,7 +193,6 @@ routes.get( * { * "eventId": "03f70b2d-53c5-11ed-9b36-000c29a89113", * "group_size": 1, - * "allow": true, * "assistants": 2000, * "confirmed": 325, * "sold_out": false, @@ -204,7 +203,12 @@ routes.get( * } */ -routes.get("/web/events/:id/check_capacity", isAPIKeyUser, eventController.checkCapacity); +routes.get("/web/events/:id/check_capacity", + isAPIKeyUser, + FieldMiddleware.middleware({ + invalidFields: generalInvalidFields, + }), + eventController.checkCapacity); /** * @api {get} /api/v4/web/events/:eventId/reservations/:encodedCode Verificar Código de Invitación @@ -438,89 +442,25 @@ routes.post( * @apiSuccess {Object[]} colleges Lista de entidades educativas. * @apiSuccess {String} colleges.id Identificador único de la entidad educativa. * @apiSuccess {String} colleges.name Nombre de la entidad educativa. - * @apiSuccess {String} [colleges.level] Nivel educativo (si aplica). - * @apiSuccess {String} colleges.country Código de país de la entidad educativa. + * @apiSuccess {String} colleges.country Código de país de la entidad educativa. * * @apiSuccessExample {json} Ejemplo de Respuesta: * [ * { - * "id": "757de756-af85-11e9-aa90-000c295f0f58", + * "id": "757de756-af85-11e9-aa90-001c295f0f58", * "name": "Academia Santa Teresa Málaga", - * "level": null, * "country": "ES" * }, * { - * "id": "7583028a-af85-11e9-aa90-000c295f0f58", + * "id": "7583028a-af85-11e9-aa90-000c395f0f58", * "name": "Academia Díaz Balaguer", - * "level": null, * "country": "ES" * }, * { - * "id": "54a4fa2d-48b4-11ee-9b36-000c29a89113", - * "name": "AECC reservas", - * "level": null, - * "country": "ES" - * }, - * { - * "id": "758137a3-af85-11e9-aa90-000c295f0f58", - * "name": "Aeroclub de Colombia", - * "level": null, - * "country": "ES" - * }, - * { - * "id": "75835f07-af85-11e9-aa90-000c295f0f58", - * "name": "AFA Formación Oviedo", - * "level": null, - * "country": "ES" - * }, - * { - * "id": "758196a7-af85-11e9-aa90-000c295f0f58", + * "id": "758196a7-af85-11e9-aa90-000c294f0f58", * "name": "Agora Portals International School - Islas Baleares", - * "level": null, * "country": "ES" * }, - * { - * "id": "75843763-af85-11e9-aa90-000c295f0f58", - * "name": "AIS Mallorca", - * "level": null, - * "country": "ES" - * }, - * { - * "id": "758314a0-af85-11e9-aa90-000c295f0f58", - * "name": "Alcalá de Henares", - * "level": null, - * "country": "ES" - * }, - * { - * "id": "75810f5a-af85-11e9-aa90-000c295f0f58", - * "name": "Alcaste - Las Fuentes", - * "level": null, - * "country": "ES" - * }, - * { - * "id": "6a574ca3-9ece-11ec-9700-000c29a89113", - * "name": "Alfaem Salud Mental - León", - * "level": null, - * "country": "ES" - * }, - * { - * "id": "75810989-af85-11e9-aa90-000c295f0f58", - * "name": "Alfonso Escamez", - * "level": null, - * "country": "ES" - * }, - * { - * "id": "a015dcef-8213-11ee-9b36-000c29a89113", - * "name": "Alianza para la FP Dual - Barcelona", - * "level": null, - * "country": "ES" - * }, - * { - * "id": "7583dd6d-af85-11e9-aa90-000c295f0f58", - * "name": "AMA-CLUB DE AMIGOS ALCORCÓN", - * "level": null, - * "country": "ES" - * } * ] */ @@ -547,117 +487,28 @@ routes.get( * @apiSuccess {Object[]} partners Lista de partners disponibles. * @apiSuccess {String} partners.id Identificador único del partner. * @apiSuccess {String} partners.name Nombre del partner. - * @apiSuccess {String} [partners.level] Nivel del partner (puede ser nulo). - * @apiSuccess {String} partners.country Código del país del partner. + * @apiSuccess {String} partners.country Código del país del partner. * * @apiSuccessExample {json} Ejemplo de Respuesta: * [ * { - "id": "7dfc4513-ce5b-11e9-8055-000c29a89113", + "id": "7dfc4513-ce5b-11e9-8055-000c29a89613", "name": "ABC", - "level": null, - "country": "ES" + "country": "ES" }, { - "id": "3c7950ac-48b4-11ee-9b36-000c29a89113", + "id": "3c7950ac-48b4-11ee-9b36-000c29a59113", "name": "AECC", - "level": null, - "country": "ES" + "country": "ES" }, { - "id": "2b43d32b-d4d1-11e9-8055-000c29a89113", + "id": "2b43d32b-d4d1-11e9-8055-000c29a69113", "name": "AGR FOOD MARKETING", - "level": null, - "country": "ES" + "country": "ES" }, { - "id": "aa0cf064-ce5b-11e9-8055-000c29a89113", - "name": "ANTONIO PAMPLIEGA", - "level": null, - "country": "ES" - }, - { - "id": "6c2df6c3-af83-11e9-aa90-000c295f0f58", - "name": "ANTONIO PINTOR", - "level": null, - "country": "ES" - }, - { - "id": "5e5472b3-6e60-11ee-9b36-000c29a89113", - "name": "Atrápalo", - "level": null, - "country": "ES" - }, - { - "id": "df469bb0-fa63-11e9-8055-000c29a89113", - "name": "AYTO. BILBAO", - "level": null, - "country": "ES" - }, - { - "id": "b37764ca-98bc-11ec-9700-000c29a89113", - "name": "AYTO. LA CORUÑA", - "level": null, - "country": "ES" - }, - { - "id": "757f1b60-af85-11e9-aa90-000c295f0f58", - "name": "AYTO. MADRID", - "level": null, - "country": "ES" - }, - { - "id": "9a2f1e6f-d954-11e9-8055-000c29a89113", - "name": "AYTO. MÁLAGA", - "level": null, - "country": "ES" - }, - { - "id": "bddfa9e9-ef85-11e9-8055-000c29a89113", - "name": "AYTO. OVIEDO", - "level": null, - "country": "ES" - }, - { - "id": "29762a98-ce5b-11e9-8055-000c29a89113", - "name": "AYTO. SEVILLA", - "level": null, - "country": "ES" - }, - { - "id": "414c97c6-5274-11ea-bdd2-000c29a89113", - "name": "BARCELÓ GRANADA", - "level": null, - "country": "ES" - }, - { - "id": "03caafb0-5270-11ea-bdd2-000c29a89113", - "name": "BIDAFARMA", - "level": null, - "country": "ES" - }, - { - "id": "db2e5387-2111-11ec-9c03-000c29a89113", - "name": "BYG", - "level": null, - "country": "ES" - }, - { - "id": "2f2c58ac-e11d-11e9-8055-000c29a89113", - "name": "CABALLITO DE MAR", - "level": null, - "country": "ES" - }, - { - "id": "59e03089-a379-11ec-9b36-000c29a89113", - "name": "Cabildo Insular de La Gomera - Area Educación", - "level": null, - "country": "ES" - }, - { - "id": "6c2df93f-af83-11e9-aa90-000c295f0f58", + "id": "6c2df93f-af83-11e9-aa90-000c29ef0f58", "name": "CAIXABANK", - "level": null, "country": "ES" }, * ...