This commit is contained in:
David Arranz 2024-09-04 13:52:08 +02:00
parent 350b49a810
commit c3c57cf188
3 changed files with 81 additions and 53 deletions

File diff suppressed because one or more lines are too long

View File

@ -5,15 +5,15 @@
<meta name="description" content="Descripción de la API de MiProyecto"> <meta name="description" content="Descripción de la API de MiProyecto">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="assets/bootstrap.min.css?v=1725450488722" rel="stylesheet" media="screen"> <link href="assets/bootstrap.min.css?v=1725450717953" rel="stylesheet" media="screen">
<link href="assets/prism.css?v=1725450488722" rel="stylesheet" /> <link href="assets/prism.css?v=1725450717953" rel="stylesheet" />
<link href="assets/prism-toolbar.css?v=1725450488722" rel="stylesheet" /> <link href="assets/prism-toolbar.css?v=1725450717953" rel="stylesheet" />
<link href="assets/prism-diff-highlight.css?v=1725450488722" rel="stylesheet" /> <link href="assets/prism-diff-highlight.css?v=1725450717953" rel="stylesheet" />
<link href="assets/main.css?v=1725450488722" rel="stylesheet" media="screen, print"> <link href="assets/main.css?v=1725450717953" rel="stylesheet" media="screen, print">
<link href="assets/favicon.ico?v=1725450488722" rel="icon" type="image/x-icon"> <link href="assets/favicon.ico?v=1725450717953" rel="icon" type="image/x-icon">
<link href="assets/apple-touch-icon.png?v=1725450488722" rel="apple-touch-icon" sizes="180x180"> <link href="assets/apple-touch-icon.png?v=1725450717953" rel="apple-touch-icon" sizes="180x180">
<link href="assets/favicon-32x32.png?v=1725450488722" rel="icon" type="image/png" sizes="32x32"> <link href="assets/favicon-32x32.png?v=1725450717953" rel="icon" type="image/png" sizes="32x32">
<link href="assets/favicon-16x16.png?v=1725450488722" rel="icon" type="image/png" sizes="16x16"> <link href="assets/favicon-16x16.png?v=1725450717953" rel="icon" type="image/png" sizes="16x16">
</head> </head>
<body class="container-fluid"> <body class="container-fluid">
@ -1042,6 +1042,6 @@
</div> </div>
</div> </div>
<script src="assets/main.bundle.js?v=1725450488722"></script> <script src="assets/main.bundle.js?v=1725450717953"></script>
</body> </body>
</html> </html>

View File

@ -46,10 +46,10 @@ const generalInvalidFields = [
"allow_overflow", "allow_overflow",
"typeId", "typeId",
"venueId", "venueId",
"locationId", "locationId",
"sold_out", "sold_out",
"level", "level",
]; ];
const eventDetailsFields = [ const eventDetailsFields = [
"id", "id",
@ -57,13 +57,13 @@ const eventDetailsFields = [
"description", "description",
"stateCode", "stateCode",
"stateText", "stateText",
"campaign_text", "campaign_text",
"init_date", "init_date",
"end_date", "end_date",
]; ];
/** /**
* @api {get} /web/events Obtener Eventos Disponibles * @api {get} /api/v4/web/events Obtener Eventos Disponibles
* @apiName GetAvailableEvents * @apiName GetAvailableEvents
* @apiGroup Eventos * @apiGroup Eventos
* @apiVersion 4.0.0 * @apiVersion 4.0.0
@ -101,17 +101,16 @@ const eventDetailsFields = [
*/ */
routes.get( routes.get(
"/web/events/", "/web/events/",
isAPIKeyUser, isAPIKeyUser,
FieldMiddleware.middleware({ FieldMiddleware.middleware({
validFields: ["id", "name"], validFields: ["id", "name"],
}), }),
(req, res, next) => { (req, res, next) => {
const scopes = ["defaultScope", "withOpenInscriptions"]; const scopes = ["defaultScope", "withOpenInscriptions"];
res.locals.v4 = {removeFields : ["partners", "speakers", "details", "multimedias", "type"]}; res.locals.v4 = { removeFields: ["partners", "speakers", "details", "multimedias", "type"] };
return eventController.find({ scopes })(req,res,next); return eventController.find({ scopes })(req, res, next);
} }
); );
/** /**
@ -159,11 +158,22 @@ routes.get(
isAPIKeyUser, isAPIKeyUser,
FieldMiddleware.middleware({ FieldMiddleware.middleware({
validFields: eventDetailsFields, validFields: eventDetailsFields,
invalidFields: generalInvalidFields, invalidFields: generalInvalidFields,
}), }),
(req, res, next) => { (req, res, next) => {
const scopes = ["defaultScope"]; const scopes = ["defaultScope"];
res.locals.v4 = {removeFields : ["partners", "speakers", "details", "multimedias", "type", "sold_out", "init_available_date", "end_available_date"]}; res.locals.v4 = {
removeFields: [
"partners",
"speakers",
"details",
"multimedias",
"type",
"sold_out",
"init_available_date",
"end_available_date",
],
};
return eventController.findOne({ scopes })(req, res, next); return eventController.findOne({ scopes })(req, res, next);
} }
); );
@ -193,14 +203,24 @@ routes.get(
* } * }
*/ */
routes.get("/web/events/:id/check_capacity", routes.get(
isAPIKeyUser, "/web/events/:id/check_capacity",
isAPIKeyUser,
FieldMiddleware.middleware({ FieldMiddleware.middleware({
invalidFields: generalInvalidFields, invalidFields: generalInvalidFields,
}), }),
(req, res, next) => { (req, res, next) => {
res.locals.v4 = {removeFields : ["assistants", "confirmed", "sold_out", "assistants_overflow", "confirmed_overflow", "sold_out_overflow"]}; res.locals.v4 = {
return eventController.checkCapacity(req, res, next); removeFields: [
"assistants",
"confirmed",
"sold_out",
"assistants_overflow",
"confirmed_overflow",
"sold_out_overflow",
],
};
return eventController.checkCapacity(req, res, next);
} }
); );
@ -246,8 +266,8 @@ routes.get(
* @apiBody {String} Apellido del participante. * @apiBody {String} Apellido del participante.
* @apiBody {String} profile Tipo de participante (student/tutor/guest/free). * @apiBody {String} profile Tipo de participante (student/tutor/guest/free).
* @apiBody {String} country País del participante (ES/MX). * @apiBody {String} country País del participante (ES/MX).
* @apiBody {String} [entityId] Entidad del participante - Opcional - solo si son student/tutor/guest.* * @apiBody {String} [entityId] Entidad del participante - Opcional - solo si son student/tutor/guest.*
* @apiBody {number} [group_size] Cantidad participantes a solicitar - Opcional - solo si son tutores.* * @apiBody {number} [group_size] Cantidad participantes a solicitar - Opcional - solo si son tutores.*
* *
* *
* @apiSuccess {String} stateText Estado de la inscripción. * @apiSuccess {String} stateText Estado de la inscripción.
@ -300,9 +320,9 @@ routes.get(
* "profile": "tutor", * "profile": "tutor",
* "country": "ES", * "country": "ES",
* "entityId": "757e6018-af85-11e9-aa90-000c295f0f58", * "entityId": "757e6018-af85-11e9-aa90-000c295f0f58",
* "group_size": 5 * "group_size": 5
* } * }
* RESPUESTA * RESPUESTA
* { * {
* "stateText": "Pendiente confirmación para tu reserva", * "stateText": "Pendiente confirmación para tu reserva",
* "type": "onsite group", * "type": "onsite group",
@ -330,7 +350,20 @@ routes.post(
eventReservationController.activeReservationToEntity, eventReservationController.activeReservationToEntity,
(req, res, next) => { (req, res, next) => {
res.locals.v4 = {removeFields : ["reservation", "id", "eventId", "date", "userId", "source", "reservationId", "overflowEventId", "updatedAt", "createdAt"]}; res.locals.v4 = {
removeFields: [
"reservation",
"id",
"eventId",
"date",
"userId",
"source",
"reservationId",
"overflowEventId",
"updatedAt",
"createdAt",
],
};
if (res.locals.dataInscription.reservation) { if (res.locals.dataInscription.reservation) {
console.log(">>>>>>>Incripcion con reserva"); console.log(">>>>>>>Incripcion con reserva");
eventReservationController.createInscriptionReservation(req, res, next); eventReservationController.createInscriptionReservation(req, res, next);
@ -343,7 +376,6 @@ routes.post(
// eventInscriptionController.createInscriptionMarketingList // eventInscriptionController.createInscriptionMarketingList
); );
/** /**
* @api {get} /api/v4/web/events/:id/inscriptions/:email Comprobar Inscripción * @api {get} /api/v4/web/events/:id/inscriptions/:email Comprobar Inscripción
* @apiName CheckInscription * @apiName CheckInscription
@ -369,11 +401,7 @@ routes.post(
* } * }
*/ */
// Comprobar si estoy inscrito al congreso por la web // Comprobar si estoy inscrito al congreso por la web
routes.get( routes.get("/web/events/:id/inscriptions/:email", isAPIKeyUser, eventInscriptionController.checkInscriptionByMail);
"/web/events/:id/inscriptions/:email",
isAPIKeyUser,
eventInscriptionController.checkInscriptionByMail);
/** /**
* @api {get} /api/v4/web/entities/colleges Lista de Entidades Educativas * @api {get} /api/v4/web/entities/colleges Lista de Entidades Educativas
@ -385,7 +413,7 @@ routes.get(
* @apiSuccess {Object[]} colleges Lista de entidades educativas. * @apiSuccess {Object[]} colleges Lista de entidades educativas.
* @apiSuccess {String} colleges.id Identificador único de la entidad educativa. * @apiSuccess {String} colleges.id Identificador único de la entidad educativa.
* @apiSuccess {String} colleges.name Nombre de la entidad educativa. * @apiSuccess {String} colleges.name Nombre de la entidad educativa.
* @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: * @apiSuccessExample {json} Ejemplo de Respuesta:
* [ * [