This commit is contained in:
David Arranz 2024-08-28 18:41:59 +02:00
parent 1e701ffbde
commit a957f1a28c
3 changed files with 3 additions and 37 deletions

View File

@ -6,6 +6,7 @@ const {
handleResultResponse, handleResultResponse,
} = require("../../helpers/controller.helper"); } = require("../../helpers/controller.helper");
function buildContext(req, config) { function buildContext(req, config) {
return { return {
user: req.user, user: req.user,
@ -35,16 +36,15 @@ const generateControllers = (service, extraControllers = {}, options = {}) => {
const defaultControllers = { const defaultControllers = {
find: (config) => { find: (config) => {
return async (req, res, next) => { return async (req, res, next) => {
console.log('>>>>>>>>>>>>>>>>>>>>>>>>>>>>>');
config = config || { config = config || {
scopes: [], scopes: [],
}; };
const params = extractParamsFromRequest(req, res, _options.params.find); const params = extractParamsFromRequest(req, res, _options.params.find);
try { try {
const result = await service.fetchAll(params, buildContext(req, config)); const result = await service.fetchAll(params, buildContext(req, config));
//MAPEO SALIDA API4
//Tratamos resultado, si hay que remover campos para API4 web //Tratamos resultado, si hay que remover campos para API4 web
if (res.locals.v4){ if (res.locals.v4){
const arrayFieldsremove = res.locals.v4.removeFields; const arrayFieldsremove = res.locals.v4.removeFields;

View File

@ -362,17 +362,6 @@ routes.get(
}), }),
// PaginateMiddleware.middleware(), // PaginateMiddleware.middleware(),
// SortMiddleware.middleware({ default: "init_available_date" }), // SortMiddleware.middleware({ default: "init_available_date" }),
/*
(req, res, next) => {
res.locals.v4 = {removeFields : ["partners", "speakers", "details", "multimedias"]};
eventController.find({
scopes: ["defaultScope", "withOpenInscriptions"],
})(req,res,next);
}
*/
eventController.find({ eventController.find({
scopes: ["defaultScope", "withOpenInscriptions"], scopes: ["defaultScope", "withOpenInscriptions"],
}) })

View File

@ -46,53 +46,30 @@ const generalInvalidFields = [
* @apiSuccess {Object[]} events Lista de eventos disponibles. * @apiSuccess {Object[]} events Lista de eventos disponibles.
* @apiSuccess {String} events.id Identificador único del evento. * @apiSuccess {String} events.id Identificador único del evento.
* @apiSuccess {String} events.name Nombre del evento. * @apiSuccess {String} events.name Nombre del evento.
* @apiSuccess {Object} events.type Tipo del evento.
* @apiSuccess {String} events.type.name Nombre del tipo de evento.
* @apiSuccess {String} events.type.title Título del tipo de evento.
* @apiSuccess {Object} events.location Ubicación del evento. * @apiSuccess {Object} events.location Ubicación del evento.
* @apiSuccess {String} events.location.country País donde se realiza el evento. * @apiSuccess {String} events.location.country País donde se realiza el evento.
* @apiSuccess {String} events.location.city Ciudad donde se realiza el evento. * @apiSuccess {String} events.location.city Ciudad donde se realiza el evento.
* @apiSuccess {String} events.location.country_code Código del país del evento. * @apiSuccess {String} events.location.country_code Código del país del evento.
* @apiSuccess {Object[]} events.multimedias Lista de recursos multimedia asociados con el evento.
* @apiSuccess {Object[]} events.details Lista de detalles adicionales del evento.
* @apiSuccess {Object[]} events.speakers Lista de oradores del evento.
* @apiSuccess {Object[]} events.partners Lista de socios del evento.
* *
* @apiSuccessExample {json} Ejemplo de Respuesta: * @apiSuccessExample {json} Ejemplo de Respuesta:
* [ * [
* { * {
* "id": "03f70b2d-53c5-11ed-9b36-000c29a89113", * "id": "03f70b2d-53c5-11ed-9b36-000c29a89113",
* "name": "Madrid 2022 - 16ª Edición", * "name": "Madrid 2022 - 16ª Edición",
* "type": {
* "name": "conference",
* "title": "Congreso LQDVI"
* },
* "location": { * "location": {
* "country": "España", * "country": "España",
* "city": "Madrid", * "city": "Madrid",
* "country_code": "ES" * "country_code": "ES"
* }, * },
* "multimedias": [],
* "details": [],
* "speakers": [],
* "partners": []
* }, * },
* { * {
* "id": "b518e0f7-b2d1-11ed-9477-000c29e7c50f", * "id": "b518e0f7-b2d1-11ed-9477-000c29e7c50f",
* "name": "Sevilla 2023 - 22ª Edición", * "name": "Sevilla 2023 - 22ª Edición",
* "type": {
* "name": "conference",
* "title": "Congreso LQDVI"
* },
* "location": { * "location": {
* "country": "España", * "country": "España",
* "city": "Sevilla", * "city": "Sevilla",
* "country_code": "ES" * "country_code": "ES"
* }, * },
* "multimedias": [],
* "details": [],
* "speakers": [],
* "partners": []
* } * }
* ] * ]
*/ */
@ -104,7 +81,7 @@ routes.get(
}), }),
(req, res, next) => { (req, res, next) => {
res.locals.v4 = {removeFields : ["partners", "speakers", "details", "multimedias"]}; res.locals.v4 = {removeFields : ["partners", "speakers", "details", "multimedias", "type"]};
eventController.find({ eventController.find({
scopes: ["defaultScope", "withOpenInscriptions"], scopes: ["defaultScope", "withOpenInscriptions"],