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="viewport" content="width=device-width, initial-scale=1.0">
<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/prism.css?v=1725450488722" rel="stylesheet" />
<link href="assets/prism-toolbar.css?v=1725450488722" rel="stylesheet" />
<link href="assets/prism-diff-highlight.css?v=1725450488722" rel="stylesheet" />
<link href="assets/main.css?v=1725450488722" rel="stylesheet" media="screen, print">
<link href="assets/favicon.ico?v=1725450488722" rel="icon" type="image/x-icon">
<link href="assets/apple-touch-icon.png?v=1725450488722" 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-16x16.png?v=1725450488722" rel="icon" type="image/png" sizes="16x16">
<link href="assets/bootstrap.min.css?v=1725450717953" rel="stylesheet" media="screen">
<link href="assets/prism.css?v=1725450717953" rel="stylesheet" />
<link href="assets/prism-toolbar.css?v=1725450717953" rel="stylesheet" />
<link href="assets/prism-diff-highlight.css?v=1725450717953" rel="stylesheet" />
<link href="assets/main.css?v=1725450717953" rel="stylesheet" media="screen, print">
<link href="assets/favicon.ico?v=1725450717953" rel="icon" type="image/x-icon">
<link href="assets/apple-touch-icon.png?v=1725450717953" rel="apple-touch-icon" sizes="180x180">
<link href="assets/favicon-32x32.png?v=1725450717953" rel="icon" type="image/png" sizes="32x32">
<link href="assets/favicon-16x16.png?v=1725450717953" rel="icon" type="image/png" sizes="16x16">
</head>
<body class="container-fluid">
@ -1042,6 +1042,6 @@
</div>
</div>
<script src="assets/main.bundle.js?v=1725450488722"></script>
<script src="assets/main.bundle.js?v=1725450717953"></script>
</body>
</html>

View File

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