From 2d843e787033a1a881d860404567e784ec59f18b Mon Sep 17 00:00:00 2001 From: David Date: Wed, 16 Mar 2022 10:08:33 +0100 Subject: [PATCH] v3 --- core/passport.js | 2 +- core/router.js | 10 +++++----- modules/auth/auth.controller.js | 6 +++--- modules/events/events_inscriptions.service.js | 8 ++++++++ 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/core/passport.js b/core/passport.js index 973fd77..e9dc141 100644 --- a/core/passport.js +++ b/core/passport.js @@ -133,7 +133,7 @@ passport.use( let user = await authService.extraMethods.findUser({ id: result.id }); if (user) { user = user.toJSON(); - const result = userService._updateLastLoginAndVersionUser( + userService._updateLastLoginAndVersionUser( user.id, appVersion ); diff --git a/core/router.js b/core/router.js index 3f64e5a..6eeca8e 100644 --- a/core/router.js +++ b/core/router.js @@ -22,7 +22,7 @@ module.exports = function () { res.json({ code: 200, message: 'success', - description: 'Welcome, this is the API for the application.' + description: 'Welcome, this is the API v3 for the application.' }); }); @@ -39,15 +39,15 @@ module.exports = function () { res.json(apicache.clear(req.params.target)) }); - - + + // Resto de rutas glob.sync("**/*.routes.js", globOptions) .forEach(function (file) { router.use('/v3', require(file)); - }); - + }); + return router; } diff --git a/modules/auth/auth.controller.js b/modules/auth/auth.controller.js index c64cfbc..b72bc0e 100644 --- a/modules/auth/auth.controller.js +++ b/modules/auth/auth.controller.js @@ -79,7 +79,7 @@ async function loginWithPhone(req, res, next) { _user = _user.toJSON(); if (appVersion) { if (_user.app_version != appVersion) { - const result = userService._updateLastLoginAndVersionUser( + userService._updateLastLoginAndVersionUser( _user.id, appVersion ); @@ -178,7 +178,7 @@ async function register(req, res, next) { name: req.body.name, surname: req.body.surname, entityId: req.body.entityid, - accessibility: req.body.accesssibility, + accessibility: req.body.accessibility, profile: req.body.profile, app_version: appVersion, lastlogin: moment().utc(), @@ -202,7 +202,7 @@ async function register(req, res, next) { newUser = cleanAdminData(newUser); if (appVersion) { if (newUser.app_version != appVersion) { - const result = userService._updateLastLoginAndVersionUser( + const result = await userService._updateLastLoginAndVersionUser( newUser.id, appVersion ); diff --git a/modules/events/events_inscriptions.service.js b/modules/events/events_inscriptions.service.js index 2a753be..924465a 100644 --- a/modules/events/events_inscriptions.service.js +++ b/modules/events/events_inscriptions.service.js @@ -59,6 +59,14 @@ const extraMethods = { }); }, + _getInscriptionByEvent: (eventId) => { + return models.EventInscription.scope("defaultScope").findAll({ + where: { + eventId: eventId, + }, + }); + }, + _getInscriptionByEventAndValidated: (eventId, validated) => { return models.EventInscription.scope("defaultScope").findAll({ where: {