diff --git a/core/controllers/index.js b/core/controllers/index.js index 06e1933..6f42166 100644 --- a/core/controllers/index.js +++ b/core/controllers/index.js @@ -74,7 +74,6 @@ const generateControllers = (service, extraControllers = {}, options = {}) => { //Tratamos resultado, si hay que remover campos para API4 web if (res.locals.v4){ const arrayFieldsremove = res.locals.v4.removeFields; - console.log('>>>>>>>>>>>>>>>>>>>>>>', result); arrayFieldsremove.forEach(campo => { if (campo in result) { delete result[campo]; diff --git a/modules/events/event.controller.js b/modules/events/event.controller.js index 5d0edf2..c7f35b9 100644 --- a/modules/events/event.controller.js +++ b/modules/events/event.controller.js @@ -104,6 +104,17 @@ const extraControllers = { }); } + //MAPEO SALIDA API4 + //Tratamos resultado, si hay que remover campos para API4 web + if (res.locals.v4){ + const arrayFieldsremove = res.locals.v4.removeFields; + arrayFieldsremove.forEach(campo => { + if (campo in result) { + delete result[campo]; + } + }); + }; + 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 5160809..e85c71a 100644 --- a/modules/events/event.routes.v4.js +++ b/modules/events/event.routes.v4.js @@ -208,7 +208,11 @@ routes.get("/web/events/:id/check_capacity", FieldMiddleware.middleware({ invalidFields: generalInvalidFields, }), - eventController.checkCapacity); + (req, res, next) => { + res.locals.v4 = {removeFields : ["assistans", "confirmed", "sold_out", "assistans_overflow", "confirmed_overflow", "sold_out_overflou"]}; + return eventController.checkCapacity(req, res, next); + } +); /** * @api {get} /api/v4/web/events/:eventId/reservations/:encodedCode Verificar Código de Invitación