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:
parent
de46b4232e
commit
4bc2298fa8
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "APP2-API",
|
||||
"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",
|
||||
"url": "https://devapi.loquedeverdadimporta.org",
|
||||
"sampleUrl": false,
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -2,18 +2,18 @@
|
||||
<html>
|
||||
<head>
|
||||
<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 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/prism.css?v=1727461894446" rel="stylesheet" />
|
||||
<link href="assets/prism-toolbar.css?v=1727461894446" rel="stylesheet" />
|
||||
<link href="assets/prism-diff-highlight.css?v=1727461894446" rel="stylesheet" />
|
||||
<link href="assets/main.css?v=1727461894446" rel="stylesheet" media="screen, print">
|
||||
<link href="assets/favicon.ico?v=1727461894446" rel="icon" type="image/x-icon">
|
||||
<link href="assets/apple-touch-icon.png?v=1727461894446" 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-16x16.png?v=1727461894446" rel="icon" type="image/png" sizes="16x16">
|
||||
<link href="assets/bootstrap.min.css?v=1730198116348" rel="stylesheet" media="screen">
|
||||
<link href="assets/prism.css?v=1730198116348" rel="stylesheet" />
|
||||
<link href="assets/prism-toolbar.css?v=1730198116348" rel="stylesheet" />
|
||||
<link href="assets/prism-diff-highlight.css?v=1730198116348" rel="stylesheet" />
|
||||
<link href="assets/main.css?v=1730198116348" rel="stylesheet" media="screen, print">
|
||||
<link href="assets/favicon.ico?v=1730198116348" rel="icon" type="image/x-icon">
|
||||
<link href="assets/apple-touch-icon.png?v=1730198116348" rel="apple-touch-icon" sizes="180x180">
|
||||
<link href="assets/favicon-32x32.png?v=1730198116348" rel="icon" type="image/png" sizes="32x32">
|
||||
<link href="assets/favicon-16x16.png?v=1730198116348" 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=1727461894446"></script>
|
||||
<script src="assets/main.bundle.js?v=1730198116348"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@ -57,7 +57,7 @@ module.exports = {
|
||||
},
|
||||
|
||||
sendinblue: {
|
||||
API_KEY: "",
|
||||
API_KEY: "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",
|
||||
},
|
||||
|
||||
hubspot: {
|
||||
|
||||
@ -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
|
||||
* @apiGroup Eventos
|
||||
* @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
|
||||
* @apiGroup Eventos
|
||||
* @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
|
||||
* @apiGroup Eventos
|
||||
* @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
|
||||
* @apiGroup Eventos
|
||||
* @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
|
||||
* @apiGroup Inscriptions
|
||||
* @apiVersion 1.0.0
|
||||
@ -270,6 +270,7 @@ routes.get(
|
||||
* @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} type Tipo de asistencia.
|
||||
* @apiSuccess {String} code_ticket Código del ticket generado.
|
||||
@ -287,6 +288,7 @@ routes.get(
|
||||
* }
|
||||
* RESPUESTA
|
||||
* {
|
||||
* "id": "003fb9ae-a8e7-41dc-802b-15dc0e1d4702",
|
||||
* "stateText": "Inscripción confirmada",
|
||||
* "type": "onsite group",
|
||||
* "code_ticket": "ENT-02220012",
|
||||
@ -304,6 +306,7 @@ routes.get(
|
||||
* }
|
||||
* RESPUESTA
|
||||
* {
|
||||
* "id": "002610be-96bb-4f56-91fc-c181d354beeb",
|
||||
* "stateText": "Pendiente confirmación para tu reserva",
|
||||
* "type": "onsite group",
|
||||
* "code_ticket": "ENT-60030638",
|
||||
@ -324,6 +327,7 @@ routes.get(
|
||||
* }
|
||||
* RESPUESTA
|
||||
* {
|
||||
"id": "00011602-8345-46e6-8c2a-7a54214cf526",
|
||||
* "stateText": "Pendiente confirmación para tu reserva",
|
||||
* "type": "onsite group",
|
||||
* "code_ticket": "ENT-19161191",
|
||||
@ -353,7 +357,6 @@ routes.post(
|
||||
res.locals.v4 = {
|
||||
removeFields: [
|
||||
"reservation",
|
||||
"id",
|
||||
"eventId",
|
||||
"date",
|
||||
"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
|
||||
* @apiGroup Inscriptions
|
||||
* @apiVersion 1.0.0
|
||||
@ -404,7 +407,8 @@ routes.post(
|
||||
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
|
||||
* @apiGroup Inscriptions
|
||||
* @apiVersion 1.0.0
|
||||
@ -427,14 +431,10 @@ routes.get("/web/events/:id/inscriptions/:email", isAPIKeyUser, eventInscription
|
||||
* }
|
||||
*/
|
||||
// Borrar una inscripción
|
||||
routes.delete("/web/inscriptions/:id",
|
||||
isAPIKeyUser,
|
||||
eventInscriptionController.deleteInscription
|
||||
);
|
||||
|
||||
routes.delete("/web/inscriptions/:id", 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
|
||||
* @apiGroup Entidades
|
||||
* @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
|
||||
* @apiGroup Partners
|
||||
* @apiVersion 4.0.0
|
||||
@ -529,5 +529,4 @@ routes.get(
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
module.exports = routes;
|
||||
|
||||
@ -98,7 +98,7 @@ const extraControllers = {
|
||||
reservationCode: req.user ? req.body.code : Buffer.from(req.body.code, "base64").toString("ascii"),
|
||||
type: typeInscription,
|
||||
groupSize: req.body.group_size ? req.body.group_size : 1, //Si no viene group_size será uno porque es una inscripcion de la APP antigua
|
||||
source: req.user ? (lodash.isEmpty(req.user)? "web4V": "app" ) : "web", //En el caso de tener ya usuario, si es vacio viene de formulario WEBV4, si no por la APP, y en caso de no tener user el formulario web actual
|
||||
source: req.user ? (lodash.isEmpty(req.user) ? "web4V" : "app") : "web", //En el caso de tener ya usuario, si es vacio viene de formulario WEBV4, si no por la APP, y en caso de no tener user el formulario web actual
|
||||
validated: false, //si no esta validado la inscripción es a la lista de espera
|
||||
inscriptionsWithoutReservationAndOverflowCount: null, //nº total de inscritos sin reserva y sin overflow asignada
|
||||
inscriptionsWithReservationCount: null, //nº total de inscritos a la reserva asignada
|
||||
@ -246,7 +246,9 @@ const extraControllers = {
|
||||
const params = extractParamsFromRequest(req, res, {});
|
||||
var eventId = params.params.id;
|
||||
var email = params.params.email;
|
||||
console.log('>checkInscriptionByMail>>>>>>>>>>>>>>>>>>>>>>>>>>>>>', eventId, email);
|
||||
|
||||
console.log(">checkInscriptionByMail>>>>>>>>>>>>>>>>>>>>>>>>>>>>>", eventId, email);
|
||||
|
||||
try {
|
||||
const user = await userService._getUserByEmail(email);
|
||||
if (user) {
|
||||
@ -432,14 +434,14 @@ console.log('>checkInscriptionByMail>>>>>>>>>>>>>>>>>>>>>>>>>>>>>', eventId, ema
|
||||
|
||||
//MAPEO SALIDA API4
|
||||
//Tratamos resultado, si hay que remover campos para API4 web
|
||||
if (res.locals.v4){
|
||||
if (res.locals.v4) {
|
||||
const arrayFieldsremove = res.locals.v4.removeFields;
|
||||
arrayFieldsremove.forEach(campo => {
|
||||
arrayFieldsremove.forEach((campo) => {
|
||||
if (campo in dataInscription.inscription) {
|
||||
delete dataInscription.inscription[campo];
|
||||
delete dataInscription.inscription[campo];
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
return handleResultResponse(await dataInscription.inscription, null, params, res, httpStatus.CREATED);
|
||||
} catch (Error) {
|
||||
@ -471,7 +473,7 @@ console.log('>checkInscriptionByMail>>>>>>>>>>>>>>>>>>>>>>>>>>>>>', eventId, ema
|
||||
if (!inscription)
|
||||
return handleResultResponse("Inscription no encontrada", null, params, res, httpStatus.NOT_FOUND);
|
||||
|
||||
//Si user{} quiere decir que lo llaman desde API4 para eliminar desde la web
|
||||
//Si user{} quiere decir que lo llaman desde API4 para eliminar desde la web
|
||||
//Si no es vacio es desde la APP y tiene que cumplirse la comprobación, de hecho esto no seria posible si es asi damos error
|
||||
if (!lodash.isEmpty(user) && inscription.userId !== user.id)
|
||||
return handleResultResponse("Inscription no encontrada", null, params, res, httpStatus.NOT_FOUND);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user