2024-08-03 15:19:39 +00:00
const { isAPIKeyUser } = require ( "../../middlewares/accessValidator" ) ;
const routes = require ( "express" ) . Router ( ) ;
const SchemaValidator = require ( "../../middlewares/schemaValidator" ) ;
const FieldMiddleware = require ( "../../middlewares/fields" ) ;
const authController = require ( "../auth/auth.controller" ) ;
const eventController = require ( "./event.controller" ) ;
const eventInscriptionController = require ( "./events_inscriptions.controller" ) ;
const eventReservationController = require ( "./events_reservations.controller" ) ;
const eventValidation = require ( "./event.validations" ) ;
const { cacheSuccesses } = require ( "../../middlewares/cache" ) ;
const SortMiddleware = require ( "../../middlewares/sort" ) ;
const entityController = require ( "../entities/entity.controller" ) ;
2024-08-28 17:45:27 +00:00
const generalInvalidFields = [
2024-08-03 15:19:39 +00:00
"userId" ,
"createdAt" ,
"updatedAt" ,
"assistants" ,
"confirmed" ,
"allow_multiple" ,
"overflow_eventId" ,
"state" ,
"confirmed" ,
"multiple_limit" ,
"marketing_list" ,
"state" ,
"contact_person" ,
"contact_email" ,
"createdAt" ,
"updatedAt" ,
2024-08-28 17:12:09 +00:00
"gmt" ,
"url_streaming" ,
"url_poll" ,
"url_registration" ,
"featured" ,
"virtual" ,
"allow_questions" ,
2024-08-28 17:20:00 +00:00
"assistanceType" ,
"assistanceTypeText" ,
"allow_overflow" ,
"typeId" ,
"venueId" ,
2024-09-04 11:52:08 +00:00
"locationId" ,
2024-08-28 17:50:57 +00:00
"sold_out" ,
2024-08-29 09:25:02 +00:00
"level" ,
2024-09-04 11:52:08 +00:00
] ;
2024-08-03 15:19:39 +00:00
2024-08-28 17:20:00 +00:00
const eventDetailsFields = [
"id" ,
"name" ,
"description" ,
"stateCode" ,
2024-08-28 17:29:28 +00:00
"stateText" ,
2024-09-04 11:52:08 +00:00
"campaign_text" ,
2024-08-28 17:29:28 +00:00
"init_date" ,
2024-09-04 11:52:08 +00:00
"end_date" ,
] ;
2024-08-28 17:20:00 +00:00
2024-08-03 15:19:39 +00:00
/ * *
2024-10-29 10:36:17 +00:00
* @ api { get } / api / v4 / web / events Obtener Eventos Disponibles ( GetAvailableEvents )
2024-08-03 15:19:39 +00:00
* @ apiName GetAvailableEvents
* @ apiGroup Eventos
* @ apiVersion 4.0 . 0
* @ apiDescription Este endpoint devuelve una lista de eventos disponibles , incluyendo su estado de aforo .
*
* @ apiSuccess { Object [ ] } events Lista de eventos disponibles .
* @ apiSuccess { String } events . id Identificador único del evento .
* @ apiSuccess { String } events . name Nombre del evento .
* @ apiSuccess { Object } events . location Ubicación del evento .
* @ apiSuccess { String } events . location . country País donde se realiza el evento .
* @ apiSuccess { String } events . location . city Ciudad donde se realiza el evento .
* @ apiSuccess { String } events . location . country _code Código del país del evento .
*
* @ apiSuccessExample { json } Ejemplo de Respuesta :
* [
* {
* "id" : "03f70b2d-53c5-11ed-9b36-000c29a89113" ,
* "name" : "Madrid 2022 - 16ª Edición" ,
* "location" : {
* "country" : "España" ,
* "city" : "Madrid" ,
* "country_code" : "ES"
* } ,
* } ,
* {
* "id" : "b518e0f7-b2d1-11ed-9477-000c29e7c50f" ,
* "name" : "Sevilla 2023 - 22ª Edición" ,
* "location" : {
* "country" : "España" ,
* "city" : "Sevilla" ,
* "country_code" : "ES"
* } ,
* }
* ]
* /
routes . get (
"/web/events/" ,
2024-09-04 11:52:08 +00:00
isAPIKeyUser ,
2024-08-03 15:19:39 +00:00
FieldMiddleware . middleware ( {
validFields : [ "id" , "name" ] ,
2024-08-28 10:47:58 +00:00
} ) ,
2024-09-04 11:52:08 +00:00
2024-08-28 11:18:05 +00:00
( req , res , next ) => {
2025-02-20 10:55:15 +00:00
//const scopes = ["defaultScope", "withOpenInscriptions"];
const scopes = [ "defaultScope" , "withSevilla" ] ;
2024-09-04 11:52:08 +00:00
res . locals . v4 = { removeFields : [ "partners" , "speakers" , "details" , "multimedias" , "type" ] } ;
return eventController . find ( { scopes } ) ( req , res , next ) ;
2024-08-28 11:18:05 +00:00
}
2024-08-03 15:19:39 +00:00
) ;
/ * *
2024-10-29 10:36:17 +00:00
* @ api { get } / api / v4 / web / events / : eventId Obtener Datos del Evento ( GetEventDetails )
2024-08-03 15:19:39 +00:00
* @ apiName GetEventDetails
* @ apiGroup Eventos
* @ apiVersion 4.0 . 0
* @ apiDescription Este endpoint devuelve los detalles de un evento específico .
*
* @ apiParam { String } eventId Identificador único del evento .
*
* @ apiSuccess { String } stateCode Código del estado del evento .
* @ apiSuccess { String } stateText Descripción del estado del evento .
* @ apiSuccess { String } id Identificador único del evento .
* @ apiSuccess { String } name Nombre del evento .
* @ apiSuccess { String } description Descripción del evento .
* @ apiSuccess { String } campaign _text Texto de campaña ( si aplica ) .
* @ apiSuccess { String } init _date Fecha y hora de inicio del evento ( ISO 8601 ) .
* @ apiSuccess { String } end _date Fecha y hora de finalización del evento ( ISO 8601 ) .
* @ apiSuccess { Object } location Ubicación del evento .
* @ apiSuccess { String } location . country País donde se realiza el evento .
* @ apiSuccess { String } location . city Ciudad donde se realiza el evento .
* @ apiSuccess { String } location . country _code Código del país del evento .
*
* @ apiSuccessExample { json } Ejemplo de Respuesta :
* {
* "stateCode" : "registrations_open" ,
* "stateText" : "Inscripciones abiertas" ,
* "id" : "03f70b2d-53c5-11ed-9b36-000c29a89113" ,
* "name" : "Madrid 2022 - 16ª Edición" ,
* "description" : "Palacio Municipal de Congresos de Madrid, Campo de las Naciones, Avenida de la Capital de España s/n\n\nENTREGA PREMIO ALGO+Q1 CANCIÓN" ,
* "campaign_text" : "" ,
* "init_date" : "2024-08-29T00:00:00.000Z" ,
* "end_date" : "2024-12-01T14:30:00.000Z" ,
2024-09-04 11:33:28 +00:00
* "location" : {
* "country" : "España" ,
* "city" : "Madrid" ,
* "country_code" : "ES"
2024-08-03 15:19:39 +00:00
* } ,
* }
* /
routes . get (
"/web/events/:id" ,
isAPIKeyUser ,
FieldMiddleware . middleware ( {
2024-08-28 17:24:03 +00:00
validFields : eventDetailsFields ,
2024-09-04 11:52:08 +00:00
invalidFields : generalInvalidFields ,
2024-08-03 15:19:39 +00:00
} ) ,
( req , res , next ) => {
const scopes = [ "defaultScope" ] ;
2024-09-04 11:52:08 +00:00
res . locals . v4 = {
removeFields : [
"partners" ,
"speakers" ,
"details" ,
"multimedias" ,
"type" ,
"sold_out" ,
"init_available_date" ,
"end_available_date" ,
] ,
} ;
2024-08-03 15:19:39 +00:00
return eventController . findOne ( { scopes } ) ( req , res , next ) ;
}
) ;
/ * *
2024-10-29 10:36:17 +00:00
* @ api { get } / api / v4 / web / events / : id / check _capacity ? group _size = xx Verificar Capacidad del Evento ( CheckEventCapacity )
2024-08-03 15:19:39 +00:00
* @ apiName CheckEventCapacity
* @ apiGroup Eventos
2024-11-08 09:52:10 +00:00
* @ apiVersion 4.0 . 0
2024-08-03 15:19:39 +00:00
* @ apiDescription Determina si hay aforo suficiente para el tamaño de grupo que se ha indicado .
*
* @ apiParam { String } id ID único del evento .
2024-09-04 11:33:28 +00:00
* @ apiParam { Number } [ group _size = 10 ] Tamaño del grupo para el cual se verifica el aforo ( Parámetro de consulta ) .
2024-08-03 15:19:39 +00:00
*
* @ apiSuccess { String } eventId ID único del evento .
* @ apiSuccess { Number } group _size Tamaño del grupo para el cual se verifica el aforo .
2024-08-29 15:45:03 +00:00
* @ apiSuccess { Boolean } allow Indica si el grupo puede inscribirse al evento .
* @ apiSuccess { Boolean } allow _overflow Indica si el grupo puede inscribirse a la lista de espera del evento .
2024-08-03 15:19:39 +00:00
*
* @ apiSuccessExample { json } Ejemplo de Respuesta :
* HTTP / 1.1 200 OK
* {
* "eventId" : "03f70b2d-53c5-11ed-9b36-000c29a89113" ,
* "group_size" : 1 ,
2024-08-29 15:45:03 +00:00
* "allow" : true
* "allow_overflow" : true
2024-08-03 15:19:39 +00:00
* }
* /
2024-09-04 11:52:08 +00:00
routes . get (
"/web/events/:id/check_capacity" ,
isAPIKeyUser ,
2024-08-29 10:51:14 +00:00
FieldMiddleware . middleware ( {
2024-09-04 11:52:08 +00:00
invalidFields : generalInvalidFields ,
2024-08-29 10:51:14 +00:00
} ) ,
2024-08-29 11:00:32 +00:00
( req , res , next ) => {
2024-09-04 11:52:08 +00:00
res . locals . v4 = {
removeFields : [
"assistants" ,
"confirmed" ,
"sold_out" ,
"assistants_overflow" ,
"confirmed_overflow" ,
"sold_out_overflow" ,
] ,
} ;
return eventController . checkCapacity ( req , res , next ) ;
2024-08-29 11:00:32 +00:00
}
) ;
2024-08-03 15:19:39 +00:00
2025-01-15 10:24:46 +00:00
/ * *
* @ api { get } / api / v4 / web / reservations / code / : encodedCode Recupera la reserva asociada al Código de Invitación ( GetReservationFromCode )
* @ apiName GetReservationFromCode
* @ apiGroup Eventos
* @ apiVersion 4.0 . 0
* @ apiDescription Este endpoint verifica un código de reserva devolviendo al evento y entidad a la que pertenece . El código de invitación está codificado en Base64 .
*
* @ apiParam { String } encodedCode Código de invitación codificado en Base64 . Ejemplo , el código "MD22-4939" se codifica como "TUQyMi00OTM5"
*
2025-01-15 10:49:16 +00:00
* @ apiSuccess { String } id indica si el Id de la reserva .
* @ apiSuccess { String } stateText indica la situación de la reserva .
* @ apiSuccess { String } code el código de la reserva sin codificar .
* @ apiSuccess { String } eventId indica el id del evento al que pertenece la reserva .
* @ apiSuccess { String } eventName indica el nombre del evento al que pertenece la reserva .
* @ apiSuccess { String } entityId indica el id de la entidad a la que pertenece la reserva .
* @ apiSuccess { String } entityName indica el nombre de la entidad a la que pertenece la reserva .
2025-01-15 10:24:46 +00:00
*
2025-01-15 10:49:16 +00:00
* @ apiError ( Error 404 ) NotFound Código de reserva no encontrado .
*
* @ apiErrorExample { json } Ejemplo de Respuesta Fallida :
* HTTP / 1.1 404 Not Found
* {
* "message" : "Código de reserva no encontrado"
* }
2025-01-15 10:24:46 +00:00
* @ apiSuccessExample { json } Ejemplo de Respuesta Exitosa :
* HTTP / 1.1 200 OK
2025-01-15 10:49:16 +00:00
* {
* "id" : "d8af01cf-b86d-4e10-9c84-442cd31a7fb8" ,
* "stateText" : "Inscripciones abiertas a la reserva" ,
* "code" : "MAD24DEF218" ,
* "eventId" : "84613446-765a-11ef-9b46-000c29a89113" ,
* "eventName" : "Madrid 2024 - 18ª Edición" ,
* "entityId" : "a015dcef-8213-11ee-9b36-000c29a89113" ,
* "entityName" : "Alianza para la FP Dual - Barcelona"
* }
2025-01-15 10:24:46 +00:00
* /
2025-01-15 09:42:18 +00:00
routes . get (
2025-01-15 10:03:10 +00:00
"/web/reservations/code/:code" ,
2025-01-15 10:24:46 +00:00
isAPIKeyUser ,
FieldMiddleware . middleware ( {
invalidFields : generalInvalidFields ,
} ) ,
( req , res , next ) => {
res . locals . v4 = {
removeFields : [
"assistanceType" ,
"assistanceTypeText" ,
"state" ,
] ,
} ;
return eventReservationController . getReservationFromCode ( req , res , next ) ;
}
2025-01-15 09:42:18 +00:00
) ;
2024-08-03 15:19:39 +00:00
/ * *
2024-10-29 10:36:17 +00:00
* @ api { get } / api / v4 / web / events / : eventId / reservations / : encodedCode Verificar Código de Invitación ( CheckInvitationCode )
2024-08-03 15:19:39 +00:00
* @ apiName CheckInvitationCode
* @ apiGroup Eventos
* @ apiVersion 4.0 . 0
* @ apiDescription Este endpoint verifica si un código de invitación es aplicable a un evento concreto . El código de invitación está codificado en Base64 .
*
* @ apiParam { String } eventId Identificador único del evento .
* @ apiParam { String } encodedCode Código de invitación codificado en Base64 . Ejemplo , el código "MD22-4939" se codifica como "TUQyMi00OTM5"
*
* @ apiSuccess { Boolean } applicable Indica si el código de invitación es aplicable ( true ) o no ( false ) .
*
* @ apiSuccessExample { json } Ejemplo de Respuesta Exitosa :
* HTTP / 1.1 200 OK
* true
*
* @ apiSuccessExample { json } Ejemplo de Respuesta Fallida :
* HTTP / 1.1 200 OK
* false
* /
routes . get (
"/web/events/:id/reservations/:encodedInvitationCode" ,
isAPIKeyUser ,
eventReservationController . checkReservationCode
) ;
/ * *
2024-10-29 10:36:17 +00:00
* @ api { post } / api / v4 / web / events / : eventId / inscriptions / Dar de Alta una Inscripción ( CreateEventInscription )
2024-08-03 15:19:39 +00:00
* @ apiName CreateEventInscription
* @ apiGroup Inscriptions
2024-11-08 09:52:10 +00:00
* @ apiVersion 4.0 . 0
2024-08-03 15:19:39 +00:00
* @ apiDescription Este endpoint permite registrar una inscripción a un evento específico .
*
* @ apiParam { String } eventId Identificador único del evento .
*
2024-08-30 11:13:22 +00:00
* @ apiBody { String } code Código opcional para la inscripción - Si viene código .
2024-08-03 15:19:39 +00:00
* @ apiBody { String } email Email del participante , debe ser válido .
* @ apiBody { String } name Nombre del participante .
2024-08-30 11:13:22 +00:00
* @ apiBody { String } Apellido del participante .
2024-09-04 10:17:01 +00:00
* @ apiBody { String } profile Tipo de participante ( student / tutor / guest / free ) .
* @ apiBody { String } country País del participante ( ES / MX ) .
2024-09-04 11:52:08 +00:00
* @ 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 . *
2024-08-03 15:19:39 +00:00
*
*
2024-10-29 10:36:17 +00:00
* @ apiSuccess { String } id ID de la inscripción .
2024-08-03 15:19:39 +00:00
* @ apiSuccess { String } stateText Estado de la inscripción .
* @ apiSuccess { String } type Tipo de asistencia .
* @ apiSuccess { String } code _ticket Código del ticket generado .
* @ apiSuccess { Boolean } validated Estado de validación de la inscripción .
*
* @ apiSuccessExample { json } Ejemplo de Respuesta 1 :
2024-09-04 10:17:01 +00:00
* ENVIO
* {
2024-08-30 11:13:22 +00:00
* "code" : "B24URD397" ,
* "email" : "rbrrbr2005@gmail.com" ,
* "name" : "aaa" ,
* "surname" : "a" ,
* "profile" : "student" ,
* "country" : "ES" ,
2024-09-04 10:17:01 +00:00
* }
* RESPUESTA
* {
2024-10-29 10:36:17 +00:00
* "id" : "003fb9ae-a8e7-41dc-802b-15dc0e1d4702" ,
2024-09-04 10:17:01 +00:00
* "stateText" : "Inscripción confirmada" ,
* "type" : "onsite group" ,
* "code_ticket" : "ENT-02220012" ,
* "validated" : true
* }
2024-08-03 15:19:39 +00:00
*
* @ apiSuccessExample { json } Ejemplo de Respuesta 2 :
2024-09-04 10:17:01 +00:00
* ENVIO
* {
* "code" : "BIL24-DEF219" , - Reserva en lista de espera
2024-08-30 11:39:30 +00:00
* "email" : "rbrrbr20067@gmail.com" ,
* "name" : "aaa" ,
* "surname" : "a" ,
* "profile" : "studient" ,
2024-09-04 10:17:01 +00:00
* }
* RESPUESTA
* {
2024-10-29 10:36:17 +00:00
* "id" : "002610be-96bb-4f56-91fc-c181d354beeb" ,
2025-01-31 10:53:19 +00:00
* "stateText" : "Reserva pendiente de confirmaci\xF3n" ,
2024-08-30 11:39:30 +00:00
* "type" : "onsite group" ,
* "code_ticket" : "ENT-60030638" ,
* "validated" : false
2024-09-04 10:17:01 +00:00
* }
2024-08-03 15:19:39 +00:00
*
2024-09-04 10:17:01 +00:00
* @ apiSuccessExample { json } Ejemplo de Respuesta 3 : Profesor solicita una reserva grupal
* ENVIO
* {
* "code" : "" ,
* "email" : "rbrrbr20167@gmail.com" ,
* "name" : "aaa" ,
* "surname" : "a" ,
* "profile" : "tutor" ,
* "country" : "ES" ,
* "entityId" : "757e6018-af85-11e9-aa90-000c295f0f58" ,
2024-09-04 11:52:08 +00:00
* "group_size" : 5
2024-09-04 10:17:01 +00:00
* }
2024-09-04 11:52:08 +00:00
* RESPUESTA
2024-09-04 10:17:01 +00:00
* {
2024-10-29 10:36:17 +00:00
"id" : "00011602-8345-46e6-8c2a-7a54214cf526" ,
2025-01-31 10:53:19 +00:00
* "stateText" : "Reserva pendiente de confirmaci\xF3n" ,
2024-09-04 10:17:01 +00:00
* "type" : "onsite group" ,
* "code_ticket" : "ENT-19161191" ,
* "validated" : false
* }
* /
2024-08-03 15:19:39 +00:00
routes . post (
"/web/events/:id/inscriptions" ,
isAPIKeyUser ,
2024-08-29 15:45:03 +00:00
SchemaValidator ( eventValidation . webv4InscriptionInputType , true ) ,
2024-08-03 15:19:39 +00:00
//Prepara los datos de la inscripción tipo ....
eventInscriptionController . prepareDataInscription ,
//Recupera la reservation si viene
eventReservationController . recuperateReservationByCode ,
//Recupera a registra el usuario que se va a inscribir
authController . getOrCreateUser ,
//Comprobamos si tiene ya una incripción, en tal caso, comprobamos el código de reserva sea el de la inscripcion hecha,
//si no es así es el caso de un usuario que se reinscribe con otro código de reserva
eventInscriptionController . checkInscriptionByUser ,
//Si es un usuario tutor y solicita un group_size se crea la reserva
eventReservationController . createReservationToEntity ,
eventReservationController . activeReservationToEntity ,
( req , res , next ) => {
2024-09-04 11:52:08 +00:00
res . locals . v4 = {
removeFields : [
"reservation" ,
"eventId" ,
"date" ,
"userId" ,
"source" ,
"reservationId" ,
"overflowEventId" ,
"updatedAt" ,
"createdAt" ,
] ,
} ;
2024-08-03 15:19:39 +00:00
if ( res . locals . dataInscription . reservation ) {
console . log ( ">>>>>>>Incripcion con reserva" ) ;
eventReservationController . createInscriptionReservation ( req , res , next ) ;
} else {
console . log ( ">>>>>>>Incripcion sin reserva" ) ;
eventInscriptionController . createInscription ( req , res , next ) ;
}
//next();
}
// eventInscriptionController.createInscriptionMarketingList
) ;
2024-09-04 11:33:28 +00:00
/ * *
2024-10-29 10:36:17 +00:00
* @ api { get } / api / v4 / web / events / : id / inscriptions / : email Comprobar Inscripción ( CheckInscription )
2024-09-04 11:33:28 +00:00
* @ apiName CheckInscription
* @ apiGroup Inscriptions
2024-11-08 09:52:10 +00:00
* @ apiVersion 4.0 . 0
2024-09-04 11:33:28 +00:00
* @ apiDescription Este endpoint verifica si el correo electrónico proporcionado tiene una inscripción para el evento concreto .
*
* @ apiParam { String } id Identificador único del evento .
* @ apiParam { String } email Correo electrónico a comprobar .
*
* @ apiSuccess { String } message Mensaje que indica el estado de la inscripción .
* @ apiSuccessExample { json } Ejemplo de Respuesta Exitosa :
* HTTP / 1.1 200 OK
* {
* "message" : "Inscripción confirmada"
* }
*
* @ apiError ( Error 404 ) NotFound No hay inscripción con el correo electrónico proporcionado .
* @ apiErrorExample { json } Ejemplo de Respuesta Fallida :
* HTTP / 1.1 404 Not Found
* {
* "message" : "No hay inscripción con ese email"
* }
* /
// Comprobar si estoy inscrito al congreso por la web
2024-09-04 11:52:08 +00:00
routes . get ( "/web/events/:id/inscriptions/:email" , isAPIKeyUser , eventInscriptionController . checkInscriptionByMail ) ;
2024-09-04 11:33:28 +00:00
2024-11-08 09:20:51 +00:00
/ * *
2024-11-08 09:26:45 +00:00
* @ api { get } / api / v4 / web / inscriptions / : id Obtener datos de la Inscripción ( GetInscription )
2024-11-08 09:20:51 +00:00
* @ apiName GetInscription
* @ apiGroup Inscriptions
2024-11-08 09:52:10 +00:00
* @ apiVersion 4.0 . 0
2024-11-08 09:20:51 +00:00
* @ apiDescription Este endpoint devuelve la inscripción correspondiente al id proporcionado .
*
* @ apiParam { String } id Identificador único de la inscripcion .
*
* @ apiSuccess { String } message datos de la inscripción .
* @ apiSuccessExample { json } Ejemplo de Respuesta Exitosa :
* HTTP / 1.1 200 OK
* {
* "id" : "4043a096-f598-4dba-b34e-ac96fdbd1b0a" ,
* "stateText" : "Inscripción confirmada" ,
* "code_ticket" : "ENT-87491914" ,
* "eventName" : "Bilbao 2024 - XVI Edición" ,
* "userName" : "aaa" ,
* "userSurname" : "a"
* }
*
* @ apiError ( Error 404 ) NotFound No hay inscripción con el id proporcionado .
* @ apiErrorExample { json } Ejemplo de Respuesta Fallida :
* HTTP / 1.1 404 Not Found
* {
* "message" : "Inscripción no encontrada"
* }
* /
2024-11-07 16:59:05 +00:00
// Esto da la inscripción de un usuario
2024-11-07 18:00:51 +00:00
routes . get ( "/web/inscriptions/:id" , isAPIKeyUser ,
FieldMiddleware . middleware ( {
} ) ,
( req , res , next ) => {
res . locals . v4 = {
removeFields : [
"code_ticket_qr" ,
] ,
} ;
2024-11-07 18:01:56 +00:00
return eventInscriptionController . getInscription ( req , res , next ) ;
2024-11-07 18:00:51 +00:00
}
) ;
2024-09-27 17:54:39 +00:00
/ * *
2024-10-29 10:36:17 +00:00
*
* @ api { delete } / api / v4 / web / inscriptions / : id Eliminar inscripcion ( DeleteInscription )
2024-09-27 17:54:39 +00:00
* @ apiName DeleteInscription
* @ apiGroup Inscriptions
2024-11-08 09:52:10 +00:00
* @ apiVersion 4.0 . 0
2024-09-27 17:54:39 +00:00
* @ apiDescription Este endpoint elimina inscripción .
*
* @ apiParam { String } id Identificador único de la inscripcion .
*
2024-09-27 18:29:59 +00:00
* @ apiSuccess { String } message Mensaje que indica resultado .
2024-09-27 17:54:39 +00:00
* @ apiSuccessExample { json } Ejemplo de Respuesta Exitosa :
* HTTP / 1.1 200 OK
* {
2024-09-27 18:29:59 +00:00
* "message" : "Inscripción eliminada"
2024-09-27 17:54:39 +00:00
* }
*
2024-09-27 18:29:59 +00:00
* @ apiError ( Error 404 ) NotFound Error al eliminar inscripción .
2024-09-27 17:54:39 +00:00
* @ apiErrorExample { json } Ejemplo de Respuesta Fallida :
* HTTP / 1.1 404 Not Found
* {
2024-09-27 18:29:59 +00:00
* "message" : "Error al eliminar inscripción"
2024-09-27 17:54:39 +00:00
* }
* /
// Borrar una inscripción
2024-10-29 10:36:17 +00:00
routes . delete ( "/web/inscriptions/:id" , isAPIKeyUser , eventInscriptionController . deleteInscription ) ;
2024-09-27 17:54:39 +00:00
2024-08-03 15:19:39 +00:00
/ * *
2024-10-29 10:36:17 +00:00
* @ api { get } / api / v4 / web / entities / colleges Lista de Entidades Educativas ( GetColleges )
2024-08-03 15:19:39 +00:00
* @ apiName GetColleges
* @ apiGroup Entidades
2024-11-08 09:52:10 +00:00
* @ apiVersion 4.0 . 0
2024-08-03 15:19:39 +00:00
* @ apiDescription Este endpoint devuelve una lista de entidades educativas , incluyendo su nombre , nivel y país .
*
* @ 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 .
2024-09-04 11:52:08 +00:00
* @ apiSuccess { String } colleges . country Código de país de la entidad educativa .
2024-08-03 15:19:39 +00:00
*
* @ apiSuccessExample { json } Ejemplo de Respuesta :
* [
* {
2024-08-29 10:51:14 +00:00
* "id" : "757de756-af85-11e9-aa90-001c295f0f58" ,
2024-08-03 15:19:39 +00:00
* "name" : "Academia Santa Teresa Málaga" ,
* "country" : "ES"
* } ,
* {
2024-08-29 10:51:14 +00:00
* "id" : "7583028a-af85-11e9-aa90-000c395f0f58" ,
2024-08-03 15:19:39 +00:00
* "name" : "Academia Díaz Balaguer" ,
* "country" : "ES"
* } ,
* {
2024-08-29 10:51:14 +00:00
* "id" : "758196a7-af85-11e9-aa90-000c294f0f58" ,
2024-08-03 15:19:39 +00:00
* "name" : "Agora Portals International School - Islas Baleares" ,
* "country" : "ES"
* } ,
* ]
* /
routes . get (
"/web/entities/colleges" ,
isAPIKeyUser ,
2024-08-29 09:23:39 +00:00
//cacheSuccesses("24 hours"),
2024-08-03 15:19:39 +00:00
FieldMiddleware . middleware ( {
2024-08-28 17:48:40 +00:00
invalidFields : generalInvalidFields ,
2024-08-03 15:19:39 +00:00
} ) ,
SortMiddleware . middleware ( { default : "name" } ) ,
entityController . find ( {
scopes : [ "defaultScope" , "onlyColleges" ] ,
} )
) ;
/ * *
2024-10-29 10:36:17 +00:00
* @ api { get } / api / v4 / web / entities / partners Lista de Partners ( GetPartners )
2024-08-03 15:19:39 +00:00
* @ apiName GetPartners
* @ apiGroup Partners
* @ apiVersion 4.0 . 0
* @ apiDescription Este endpoint devuelve una lista de partners disponibles , incluyendo su nombre , nivel y país .
*
* @ apiSuccess { Object [ ] } partners Lista de partners disponibles .
* @ apiSuccess { String } partners . id Identificador único del partner .
* @ apiSuccess { String } partners . name Nombre del partner .
2024-08-29 10:51:14 +00:00
* @ apiSuccess { String } partners . country Código del país del partner .
2024-08-03 15:19:39 +00:00
*
* @ apiSuccessExample { json } Ejemplo de Respuesta :
* [
* {
2024-08-29 10:51:14 +00:00
"id" : "7dfc4513-ce5b-11e9-8055-000c29a89613" ,
2024-08-03 15:19:39 +00:00
"name" : "ABC" ,
2024-08-29 10:51:14 +00:00
"country" : "ES"
2024-08-03 15:19:39 +00:00
} ,
{
2024-08-29 10:51:14 +00:00
"id" : "3c7950ac-48b4-11ee-9b36-000c29a59113" ,
2024-08-03 15:19:39 +00:00
"name" : "AECC" ,
2024-08-29 10:51:14 +00:00
"country" : "ES"
2024-08-03 15:19:39 +00:00
} ,
{
2024-08-29 10:51:14 +00:00
"id" : "2b43d32b-d4d1-11e9-8055-000c29a69113" ,
2024-08-03 15:19:39 +00:00
"name" : "AGR FOOD MARKETING" ,
2024-08-29 10:51:14 +00:00
"country" : "ES"
2024-08-03 15:19:39 +00:00
} ,
{
2024-08-29 10:51:14 +00:00
"id" : "6c2df93f-af83-11e9-aa90-000c29ef0f58" ,
2024-08-03 15:19:39 +00:00
"name" : "CAIXABANK" ,
"country" : "ES"
} ,
* ...
* ]
* /
routes . get (
"/web/entities/partners" ,
isAPIKeyUser ,
2024-08-29 09:23:39 +00:00
//cacheSuccesses("24 hours"),
2024-08-03 15:19:39 +00:00
FieldMiddleware . middleware ( {
2024-08-28 17:48:40 +00:00
invalidFields : generalInvalidFields ,
2024-08-03 15:19:39 +00:00
} ) ,
SortMiddleware . middleware ( { default : "name" } ) ,
entityController . find ( {
scopes : [ "defaultScope" , "onlyPartners" ] ,
} )
) ;
module . exports = routes ;