Dar el ID de la inscripción en la v4 para los formularios. Activar correos en el entorno de pruebas. Documentación de la API mejorada.

This commit is contained in:
David Arranz 2024-10-29 11:36:17 +01:00
parent de46b4232e
commit 4bc2298fa8
6 changed files with 50 additions and 46 deletions

View File

@ -1,7 +1,7 @@
{ {
"name": "APP2-API", "name": "APP2-API",
"version": "4.0.0", "version": "4.0.0",
"description": "Descripción de la API de MiProyecto", "description": "Descripción de la API de la APP LQDVI",
"title": "Documentación de la API", "title": "Documentación de la API",
"url": "https://devapi.loquedeverdadimporta.org", "url": "https://devapi.loquedeverdadimporta.org",
"sampleUrl": false, "sampleUrl": false,

File diff suppressed because one or more lines are too long

View File

@ -2,18 +2,18 @@
<html> <html>
<head> <head>
<title>Documentación de la API</title> <title>Documentación de la API</title>
<meta name="description" content="Descripción de la API de MiProyecto"> <meta name="description" content="Descripción de la API de la APP LQDVI">
<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=1727461894446" rel="stylesheet" media="screen"> <link href="assets/bootstrap.min.css?v=1730198116348" rel="stylesheet" media="screen">
<link href="assets/prism.css?v=1727461894446" rel="stylesheet" /> <link href="assets/prism.css?v=1730198116348" rel="stylesheet" />
<link href="assets/prism-toolbar.css?v=1727461894446" rel="stylesheet" /> <link href="assets/prism-toolbar.css?v=1730198116348" rel="stylesheet" />
<link href="assets/prism-diff-highlight.css?v=1727461894446" rel="stylesheet" /> <link href="assets/prism-diff-highlight.css?v=1730198116348" rel="stylesheet" />
<link href="assets/main.css?v=1727461894446" rel="stylesheet" media="screen, print"> <link href="assets/main.css?v=1730198116348" rel="stylesheet" media="screen, print">
<link href="assets/favicon.ico?v=1727461894446" rel="icon" type="image/x-icon"> <link href="assets/favicon.ico?v=1730198116348" rel="icon" type="image/x-icon">
<link href="assets/apple-touch-icon.png?v=1727461894446" rel="apple-touch-icon" sizes="180x180"> <link href="assets/apple-touch-icon.png?v=1730198116348" rel="apple-touch-icon" sizes="180x180">
<link href="assets/favicon-32x32.png?v=1727461894446" rel="icon" type="image/png" sizes="32x32"> <link href="assets/favicon-32x32.png?v=1730198116348" rel="icon" type="image/png" sizes="32x32">
<link href="assets/favicon-16x16.png?v=1727461894446" rel="icon" type="image/png" sizes="16x16"> <link href="assets/favicon-16x16.png?v=1730198116348" 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=1727461894446"></script> <script src="assets/main.bundle.js?v=1730198116348"></script>
</body> </body>
</html> </html>

View File

@ -57,7 +57,7 @@ module.exports = {
}, },
sendinblue: { sendinblue: {
API_KEY: "", API_KEY: "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",
}, },
hubspot: { hubspot: {

View File

@ -63,7 +63,7 @@ const eventDetailsFields = [
]; ];
/** /**
* @api {get} /api/v4/web/events Obtener Eventos Disponibles * @api {get} /api/v4/web/events Obtener Eventos Disponibles (GetAvailableEvents)
* @apiName GetAvailableEvents * @apiName GetAvailableEvents
* @apiGroup Eventos * @apiGroup Eventos
* @apiVersion 4.0.0 * @apiVersion 4.0.0
@ -114,7 +114,7 @@ routes.get(
); );
/** /**
* @api {get} /api/v4/web/events/:eventId Obtener Datos del Evento * @api {get} /api/v4/web/events/:eventId Obtener Datos del Evento (GetEventDetails)
* @apiName GetEventDetails * @apiName GetEventDetails
* @apiGroup Eventos * @apiGroup Eventos
* @apiVersion 4.0.0 * @apiVersion 4.0.0
@ -179,7 +179,7 @@ routes.get(
); );
/** /**
* @api {get} /api/v4/web/events/:id/check_capacity?group_size=xx Verificar Capacidad del Evento * @api {get} /api/v4/web/events/:id/check_capacity?group_size=xx Verificar Capacidad del Evento (CheckEventCapacity)
* @apiName CheckEventCapacity * @apiName CheckEventCapacity
* @apiGroup Eventos * @apiGroup Eventos
* @apiVersion 1.0.0 * @apiVersion 1.0.0
@ -225,7 +225,7 @@ routes.get(
); );
/** /**
* @api {get} /api/v4/web/events/:eventId/reservations/:encodedCode Verificar Código de Invitación * @api {get} /api/v4/web/events/:eventId/reservations/:encodedCode Verificar Código de Invitación (CheckInvitationCode)
* @apiName CheckInvitationCode * @apiName CheckInvitationCode
* @apiGroup Eventos * @apiGroup Eventos
* @apiVersion 4.0.0 * @apiVersion 4.0.0
@ -252,7 +252,7 @@ routes.get(
); );
/** /**
* @api {post} /api/v4/web/events/:eventId/inscriptions/ Dar de Alta una Inscripción * @api {post} /api/v4/web/events/:eventId/inscriptions/ Dar de Alta una Inscripción (CreateEventInscription)
* @apiName CreateEventInscription * @apiName CreateEventInscription
* @apiGroup Inscriptions * @apiGroup Inscriptions
* @apiVersion 1.0.0 * @apiVersion 1.0.0
@ -270,6 +270,7 @@ routes.get(
* @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} id ID de la inscripción.
* @apiSuccess {String} stateText Estado de la inscripción. * @apiSuccess {String} stateText Estado de la inscripción.
* @apiSuccess {String} type Tipo de asistencia. * @apiSuccess {String} type Tipo de asistencia.
* @apiSuccess {String} code_ticket Código del ticket generado. * @apiSuccess {String} code_ticket Código del ticket generado.
@ -287,6 +288,7 @@ routes.get(
* } * }
* RESPUESTA * RESPUESTA
* { * {
* "id": "003fb9ae-a8e7-41dc-802b-15dc0e1d4702",
* "stateText": "Inscripción confirmada", * "stateText": "Inscripción confirmada",
* "type": "onsite group", * "type": "onsite group",
* "code_ticket": "ENT-02220012", * "code_ticket": "ENT-02220012",
@ -304,6 +306,7 @@ routes.get(
* } * }
* RESPUESTA * RESPUESTA
* { * {
* "id": "002610be-96bb-4f56-91fc-c181d354beeb",
* "stateText": "Pendiente confirmación para tu reserva", * "stateText": "Pendiente confirmación para tu reserva",
* "type": "onsite group", * "type": "onsite group",
* "code_ticket": "ENT-60030638", * "code_ticket": "ENT-60030638",
@ -324,6 +327,7 @@ routes.get(
* } * }
* RESPUESTA * RESPUESTA
* { * {
"id": "00011602-8345-46e6-8c2a-7a54214cf526",
* "stateText": "Pendiente confirmación para tu reserva", * "stateText": "Pendiente confirmación para tu reserva",
* "type": "onsite group", * "type": "onsite group",
* "code_ticket": "ENT-19161191", * "code_ticket": "ENT-19161191",
@ -353,7 +357,6 @@ routes.post(
res.locals.v4 = { res.locals.v4 = {
removeFields: [ removeFields: [
"reservation", "reservation",
"id",
"eventId", "eventId",
"date", "date",
"userId", "userId",
@ -377,7 +380,7 @@ routes.post(
); );
/** /**
* @api {get} /api/v4/web/events/:id/inscriptions/:email Comprobar Inscripción * @api {get} /api/v4/web/events/:id/inscriptions/:email Comprobar Inscripción (CheckInscription)
* @apiName CheckInscription * @apiName CheckInscription
* @apiGroup Inscriptions * @apiGroup Inscriptions
* @apiVersion 1.0.0 * @apiVersion 1.0.0
@ -404,7 +407,8 @@ routes.post(
routes.get("/web/events/:id/inscriptions/:email", isAPIKeyUser, eventInscriptionController.checkInscriptionByMail); routes.get("/web/events/:id/inscriptions/:email", isAPIKeyUser, eventInscriptionController.checkInscriptionByMail);
/** /**
* @api {delete} /api/v4/web/inscriptions/:id Eliminar inscripcion *
* @api {delete} /api/v4/web/inscriptions/:id Eliminar inscripcion (DeleteInscription)
* @apiName DeleteInscription * @apiName DeleteInscription
* @apiGroup Inscriptions * @apiGroup Inscriptions
* @apiVersion 1.0.0 * @apiVersion 1.0.0
@ -427,14 +431,10 @@ routes.get("/web/events/:id/inscriptions/:email", isAPIKeyUser, eventInscription
* } * }
*/ */
// Borrar una inscripción // Borrar una inscripción
routes.delete("/web/inscriptions/:id", routes.delete("/web/inscriptions/:id", isAPIKeyUser, eventInscriptionController.deleteInscription);
isAPIKeyUser,
eventInscriptionController.deleteInscription
);
/** /**
* @api {get} /api/v4/web/entities/colleges Lista de Entidades Educativas * @api {get} /api/v4/web/entities/colleges Lista de Entidades Educativas (GetColleges)
* @apiName GetColleges * @apiName GetColleges
* @apiGroup Entidades * @apiGroup Entidades
* @apiVersion 1.0.0 * @apiVersion 1.0.0
@ -479,7 +479,7 @@ routes.get(
); );
/** /**
* @api {get} /api/v4/web/entities/partners Lista de Partners * @api {get} /api/v4/web/entities/partners Lista de Partners (GetPartners)
* @apiName GetPartners * @apiName GetPartners
* @apiGroup Partners * @apiGroup Partners
* @apiVersion 4.0.0 * @apiVersion 4.0.0
@ -529,5 +529,4 @@ routes.get(
}) })
); );
module.exports = routes; module.exports = routes;

View File

@ -246,7 +246,9 @@ const extraControllers = {
const params = extractParamsFromRequest(req, res, {}); const params = extractParamsFromRequest(req, res, {});
var eventId = params.params.id; var eventId = params.params.id;
var email = params.params.email; var email = params.params.email;
console.log('>checkInscriptionByMail>>>>>>>>>>>>>>>>>>>>>>>>>>>>>', eventId, email);
console.log(">checkInscriptionByMail>>>>>>>>>>>>>>>>>>>>>>>>>>>>>", eventId, email);
try { try {
const user = await userService._getUserByEmail(email); const user = await userService._getUserByEmail(email);
if (user) { if (user) {
@ -434,12 +436,12 @@ console.log('>checkInscriptionByMail>>>>>>>>>>>>>>>>>>>>>>>>>>>>>', eventId, ema
//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;
arrayFieldsremove.forEach(campo => { arrayFieldsremove.forEach((campo) => {
if (campo in dataInscription.inscription) { if (campo in dataInscription.inscription) {
delete dataInscription.inscription[campo]; delete dataInscription.inscription[campo];
} }
}); });
}; }
return handleResultResponse(await dataInscription.inscription, null, params, res, httpStatus.CREATED); return handleResultResponse(await dataInscription.inscription, null, params, res, httpStatus.CREATED);
} catch (Error) { } catch (Error) {