a
This commit is contained in:
parent
372f3a502c
commit
b0b94b963b
@ -55,6 +55,24 @@ const extraControllers = {
|
|||||||
console.log('usuariooooooooooooo--CASO CON TOKEN');
|
console.log('usuariooooooooooooo--CASO CON TOKEN');
|
||||||
console.log(req.user);
|
console.log(req.user);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var origin = (req.user && req.user.role == 90) ? 'admin' : 'web';
|
||||||
|
|
||||||
|
var user = {
|
||||||
|
id: null,
|
||||||
|
email: req.body.email,
|
||||||
|
name: req.body.name,
|
||||||
|
surname: req.body.surname
|
||||||
|
};
|
||||||
|
|
||||||
|
var invitationCode = Buffer.from(req.params.encodedInvitationCode, 'base64').toString('ascii');
|
||||||
|
console.log(user, invitationCode);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
let dataUser = {
|
let dataUser = {
|
||||||
id: req.user.id,
|
id: req.user.id,
|
||||||
phone: req.user.phone,
|
phone: req.user.phone,
|
||||||
@ -241,7 +259,35 @@ const extraControllers = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return handleResultResponse(await dataInscription.inscription.toJSON(), null, params, res, httpStatus.CREATED)
|
return handleResultResponse(await dataInscription.inscription.toJSON(), null, params, res, httpStatus.CREATED)
|
||||||
|
|
||||||
|
/*
|
||||||
|
if (invitationCode) {
|
||||||
|
_getLevelAndPartner()
|
||||||
|
.then(_getOrCreateUser)
|
||||||
|
.then(_existsInscription)
|
||||||
|
.then(_getInscriptionCount)
|
||||||
|
.then(_updateLevel)
|
||||||
|
.then(_createInscription) --------------------> HASTA AQUI
|
||||||
|
.then(_addMember)
|
||||||
|
.then(_updateInscription)
|
||||||
|
.then(_getConference)
|
||||||
|
.then(_sendConfirmMail)
|
||||||
|
.then(_handleResponse)
|
||||||
|
.catch(_handleError);
|
||||||
|
} else {
|
||||||
|
_existsInscription()
|
||||||
|
.then(_getInscriptionCount)
|
||||||
|
.then(_getConference)
|
||||||
|
.then(_updateConference)
|
||||||
|
.then(_createInscription) -----------------------> HASTA AQUI
|
||||||
|
.then(_addMember)
|
||||||
|
.then(_updateInscription)
|
||||||
|
.then(_handleResponse)
|
||||||
|
.catch(_handleError);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -113,10 +113,17 @@ routes.get('/events/:id/inscriptions',
|
|||||||
// Hacer una inscripción
|
// Hacer una inscripción
|
||||||
routes.post('/events/:id/inscriptions',
|
routes.post('/events/:id/inscriptions',
|
||||||
isLoggedUser,
|
isLoggedUser,
|
||||||
// SchemaValidator(eventValidation.InscriptionInputType, true),
|
SchemaValidator(eventValidation.InscriptionInputType, true),
|
||||||
eventController.createInscription
|
eventController.createInscription
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Hacer una inscripción por la web
|
||||||
|
routes.post('/events/:id/webinscriptions',
|
||||||
|
SchemaValidator(eventValidation.webInscriptionInputType, true),
|
||||||
|
eventController.createInscription
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
routes.delete('/events/:id/inscriptions',
|
routes.delete('/events/:id/inscriptions',
|
||||||
// Borrar una inscripción (poner el id de la inscripción????)
|
// Borrar una inscripción (poner el id de la inscripción????)
|
||||||
isLoggedUser,
|
isLoggedUser,
|
||||||
|
|||||||
@ -3,17 +3,18 @@ const Joi = require('joi');
|
|||||||
const InscriptionInputType = Joi.object().keys({
|
const InscriptionInputType = Joi.object().keys({
|
||||||
id: Joi.string().required(),
|
id: Joi.string().required(),
|
||||||
code: Joi.string().optional()
|
code: Joi.string().optional()
|
||||||
|
|
||||||
/* address: Joi.string().required(),
|
|
||||||
city: Joi.string().required(),
|
|
||||||
gmt: Joi.number().min(-12).max(+12),
|
|
||||||
description: Joi.string().optional(),
|
|
||||||
country: Joi.string().optional(),
|
|
||||||
state: Joi.string().optional(),
|
|
||||||
postal_code: Joi.string().optional(),
|
|
||||||
accessibility: Joi.string().optional()
|
|
||||||
*/
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const webInscriptionInputType = Joi.object().keys({
|
||||||
|
id: Joi.string().required(),
|
||||||
|
code: Joi.string().required(),
|
||||||
|
email: Joi.string().email({ minDomainSegments: 2 }).required(),
|
||||||
|
name: Joi.string().required(),
|
||||||
|
surname: Joi.string().optional(),
|
||||||
|
phone: Joi.string().optional()
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
const EventsListOutputType = Joi.object().keys({
|
const EventsListOutputType = Joi.object().keys({
|
||||||
id: Joi.string().required(),
|
id: Joi.string().required(),
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user