.
This commit is contained in:
parent
585f2ff0d8
commit
8986183a53
@ -366,7 +366,7 @@ async function getOrCreateUser(req, res, next) {
|
||||
|
||||
//console.log(">>>>>>>>>>>>>>>>>>>> getOrCreateUser", dataUser.userResult.user.Entity);
|
||||
//Refrescamos datos que nos interesan
|
||||
dataUser.id = dataUser.userResult.user.id;
|
||||
dataUser.id = dataUser.userResult.user.id; //caso API V4 no recuperamos Entidad, asignamos entityId del parametro dado
|
||||
dataUser.entityId = dataUser.userResult.user.Entity ? dataUser.userResult.user.Entity.id : (dataUser.userResult.user.entityId? dataUser.userResult.user.entityId : null);
|
||||
dataUser.entityName = dataUser.userResult.user.Entity ? dataUser.userResult.user.Entity.name : "DEFAULT";
|
||||
dataUser.entityLevel = dataUser.userResult.user.Entity ? dataUser.userResult.user.Entity.level : null;
|
||||
|
||||
@ -240,10 +240,14 @@ routes.get(
|
||||
*
|
||||
* @apiParam {String} eventId Identificador único del evento.
|
||||
*
|
||||
* @apiBody {String} code Código opcional para la inscripción.
|
||||
* @apiBody {String} code Código opcional para la inscripción - Si viene código.
|
||||
* @apiBody {String} email Email del participante, debe ser válido.
|
||||
* @apiBody {String} name Nombre del participante.
|
||||
* @apiBody {String} [surname] Apellido del participante (opcional).
|
||||
* @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.*
|
||||
*
|
||||
*
|
||||
* @apiSuccess {String} stateText Estado de la inscripción.
|
||||
@ -261,6 +265,16 @@ routes.get(
|
||||
* @apiSuccess {Date} createdAt Fecha de creación.
|
||||
*
|
||||
* @apiSuccessExample {json} Ejemplo de Respuesta 1:
|
||||
* {
|
||||
* "code" : "B24URD397",
|
||||
* "email" : "rbrrbr2005@gmail.com",
|
||||
* "name" : "aaa",
|
||||
* "surname" : "a",
|
||||
* "profile": "student",
|
||||
* "country": "ES",
|
||||
* "entityId": "757e6018-af85-11e9-aa90-000c295f0f58",
|
||||
* "group_size": 5
|
||||
* }
|
||||
* {
|
||||
* "stateText": "Inscripción confirmada",
|
||||
* "id": "156e4aa1-cada-4e42-bdca-b458b798991c",
|
||||
@ -414,6 +428,7 @@ routes.post(
|
||||
eventReservationController.activeReservationToEntity,
|
||||
|
||||
(req, res, next) => {
|
||||
res.locals.v4 = {removeFields : ["reservation"]};
|
||||
if (res.locals.dataInscription.reservation) {
|
||||
console.log(">>>>>>>Incripcion con reserva");
|
||||
eventReservationController.createInscriptionReservation(req, res, next);
|
||||
|
||||
@ -603,6 +603,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 Result) {
|
||||
delete Result[campo];
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
return handleResultResponse(Result, null, params, res, httpStatus.CREATED);
|
||||
} catch (error) {
|
||||
return handleResultResponse("Error al crear la incripción online", null, params, res, httpStatus.NOT_FOUND);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user