This commit is contained in:
David Arranz 2024-08-30 13:39:30 +02:00
parent 3bb8a16476
commit 51103883db
3 changed files with 42 additions and 124 deletions

View File

@ -138,7 +138,7 @@ const extraMethods = {
where: {
email: dataUser.email,
},
include: [{ model: models.Entity }], //lo quitamos porque el join con entidad vacia nunca lo encuentra y siempre crea el correo.
// include: [{ model: models.Entity }], //lo quitamos porque el join con entidad vacia nunca lo encuentra y siempre crea el correo.
defaults: {
email: dataUser.email,
name: dataUser.name,

View File

@ -251,18 +251,9 @@ routes.get(
*
*
* @apiSuccess {String} stateText Estado de la inscripción.
* @apiSuccess {String} id Identificador único de la inscripción.
* @apiSuccess {String} eventId Identificador único del evento.
* @apiSuccess {Date} date Fecha de la inscripción.
* @apiSuccess {String} userId Identificador único del usuario.
* @apiSuccess {String} type Tipo de asistencia.
* @apiSuccess {String} code_ticket Código del ticket generado.
* @apiSuccess {String} source Fuente de la inscripción (ej. "app").
* @apiSuccess {Boolean} validated Estado de validación de la inscripción.
* @apiSuccess {String} [reservationId] Identificador de la reserva si existe.
* @apiSuccess {String} [overflowEventId] Identificador del evento de desborde si existe.
* @apiSuccess {Date} updatedAt Fecha de la última actualización.
* @apiSuccess {Date} createdAt Fecha de creación.
*
* @apiSuccessExample {json} Ejemplo de Respuesta 1:
* {
@ -292,122 +283,38 @@ routes.get(
* }
*
* @apiSuccessExample {json} Ejemplo de Respuesta 2:
* {
* "reservation": {
* "assistanceType": "onsite",
* "assistanceTypeText": "asistencia presencial",
* "stateText": "Inscripciones abiertas a la reserva",
* "id": "b996c360-616d-46d4-856f-4dc0449b74f8",
* "init_available_date": "2024-06-03T15:00:00.000Z",
* "end_available_date": "2024-10-08T20:00:00.000Z",
* "gmt": -5,
* "state": "publish",
* "assistants": 10,
* "confirmed": 1,
* "sold_out": false,
* "allow_multiple": false,
* "multiple_limit": 0,
* "description": "Reserva",
* "reservation_code": "TOL24-CIE339",
* "color": "orange",
* "allow_overflow": false,
* "overflow_reservationId": null,
* "marketing_list": null,
* "virtual": false,
* "createdAt": "2024-07-02T09:39:38.000Z",
* "updatedAt": "2024-07-02T09:40:07.000Z",
* "userId": "d3eba5de-76cd-44a0-9ebd-92cad7160e71",
* "entityId": "9c910423-596b-11ea-bdd2-000c29a89113",
* "eventId": "3028d48b-1f38-11ef-9b46-000c29a89113",
* "Event": {
* "stateCode": "registrations_open",
* "stateText": "Inscripciones abiertas",
* "assistanceType": "onsite",
* "assistanceTypeText": "evento presencial",
* "id": "3028d48b-1f38-11ef-9b46-000c29a89113",
* "name": "Toluca 2024 - Teen - 6ª Edición",
* "description": null,
* "campaign_text": null,
* "init_date": "2024-10-09T15:00:00.000Z",
* "end_date": "2024-10-09T19:00:00.000Z",
* "init_available_date": "2024-06-03T15:00:00.000Z",
* "end_available_date": "2024-10-08T20:00:00.000Z",
* "gmt": -5,
* "assistants": 620,
* "confirmed": 1,
* "sold_out": false,
* "allow_multiple": false,
* "multiple_limit": null,
* "allow_overflow": true,
* "overflow_eventId": "36a1aed0-1f39-11ef-9b46-000c29a89113",
* "state": "publish",
* "typeId": "0",
* "venueId": "2481e357-1dfb-4ab7-ba2b-5094620e0281",
* "locationId": "df971e1c-c8de-11e9-b18d-000c295f0f58",
* "url_streaming": null,
* "url_poll": null,
* "url_registration": null,
* "marketing_list": null,
* "userId": "0939bb2a-d33d-4290-ac81-fc9faa1c015e",
* "featured": false,
* "virtual": false,
* "allow_questions": true,
* "createdAt": "2024-05-31T12:26:05.000Z",
* "updatedAt": "2024-07-02T09:40:07.000Z",
* "type": {
* "name": "conference",
* "title": "Congreso LQDVI"
* },
* "location": {
* "country": "México",
* "city": "Toluca",
* "country_code": "MX"
* }
* },
* "Entity": {
* "id": "9c910423-596b-11ea-bdd2-000c29a89113",
* "name": "CIEMA A Coruña",
* "state": "publish",
* "contact_person": null,
* "contact_email": null,
* "level": null,
* "country": "ES",
* "createdAt": "2020-02-27T15:15:31.000Z",
* "updatedAt": "2020-02-27T15:15:31.000Z"
* }
* },
* "stateText": "Inscripción confirmada",
* "id": "2168615f-69b3-4045-a173-5b70f5ebfd1d",
* "eventId": "3028d48b-1f38-11ef-9b46-000c29a89113",
* "date": "2024-07-02T09:42:34.846Z",
* "userId": "6747d9eb-c64f-43a3-a4ac-6803b89966cb",
* "type": "onsite group",
* "code_ticket": "ENT-31846388",
* "source": "app",
* "validated": true,
* "reservationId": "b996c360-616d-46d4-856f-4dc0449b74f8",
* "overflowEventId": null,
* "updatedAt": "2024-07-02T09:42:34.847Z",
* "createdAt": "2024-07-02T09:42:34.847Z"
* }
* {
* "code" : "BIL24-DEF219",
* "email" : "rbrrbr20067@gmail.com",
* "name" : "aaa",
* "surname" : "a",
* "profile": "studient",
* }
* {
* "stateText": "Pendiente confirmación para tu reserva",
* "type": "onsite group",
* "code_ticket": "ENT-60030638",
* "validated": false
* }
*
* @apiSuccessExample {json} Ejemplo de Respuesta 3:
* {
* "stateText": "Inscripción confirmada a lista de espera",
* "id": "9c6548df-37d8-46c1-8505-3de9e620fab1",
* "eventId": "3028d48b-1f38-11ef-9b46-000c29a89113",
* "date": "2024-07-02T09:32:45.727Z",
* "userId": "6747d9eb-c64f-43a3-a4ac-6803b89966cb",
* "type": "onsite",
* "code_ticket": "ENT-26677167",
* "source": "app",
* "validated": false,
* "reservationId": null,
* "overflowEventId": "36a1aed0-1f39-11ef-9b46-000c29a89113",
* "updatedAt": "2024-07-02T09:32:45.728Z",
* "createdAt": "2024-07-02T09:32:45.728Z"
* }
*/
* {
* "code" : "",
* "email" : "rbrrbr20167@gmail.com",
* "name" : "aaa",
* "surname" : "a",
* "profile": "tutor",
* "country": "ES",
* "entityId": "757e6018-af85-11e9-aa90-000c295f0f58",
* "group_size": 5
* }
* {
* "stateText": "Pendiente confirmación para tu reserva",
* "type": "onsite group",
* "code_ticket": "ENT-19161191",
* "validated": false
* }
*/
routes.post(
"/web/events/:id/inscriptions",

View File

@ -430,6 +430,17 @@ const extraControllers = {
console.log("Se ha producido un error al enviar mail>>>>>>>>>>>>>>>>><<", error);
}
//MAPEO SALIDA API4
//Tratamos resultado, si hay que remover campos para API4 web
if (res.locals.v4){
const arrayFieldsremove = res.locals.v4.removeFields;
arrayFieldsremove.forEach(campo => {
if (campo in dataInscription.inscription) {
delete dataInscription.inscription[campo];
}
});
};
return handleResultResponse(await dataInscription.inscription, null, params, res, httpStatus.CREATED);
} catch (Error) {
return handleResultResponse(