This commit is contained in:
David Arranz 2022-03-16 10:08:33 +01:00
parent a005555840
commit 2d843e7870
4 changed files with 17 additions and 9 deletions

View File

@ -133,7 +133,7 @@ passport.use(
let user = await authService.extraMethods.findUser({ id: result.id }); let user = await authService.extraMethods.findUser({ id: result.id });
if (user) { if (user) {
user = user.toJSON(); user = user.toJSON();
const result = userService._updateLastLoginAndVersionUser( userService._updateLastLoginAndVersionUser(
user.id, user.id,
appVersion appVersion
); );

View File

@ -22,7 +22,7 @@ module.exports = function () {
res.json({ res.json({
code: 200, code: 200,
message: 'success', 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)) res.json(apicache.clear(req.params.target))
}); });
// Resto de rutas // Resto de rutas
glob.sync("**/*.routes.js", globOptions) glob.sync("**/*.routes.js", globOptions)
.forEach(function (file) { .forEach(function (file) {
router.use('/v3', require(file)); router.use('/v3', require(file));
}); });
return router; return router;
} }

View File

@ -79,7 +79,7 @@ async function loginWithPhone(req, res, next) {
_user = _user.toJSON(); _user = _user.toJSON();
if (appVersion) { if (appVersion) {
if (_user.app_version != appVersion) { if (_user.app_version != appVersion) {
const result = userService._updateLastLoginAndVersionUser( userService._updateLastLoginAndVersionUser(
_user.id, _user.id,
appVersion appVersion
); );
@ -178,7 +178,7 @@ async function register(req, res, next) {
name: req.body.name, name: req.body.name,
surname: req.body.surname, surname: req.body.surname,
entityId: req.body.entityid, entityId: req.body.entityid,
accessibility: req.body.accesssibility, accessibility: req.body.accessibility,
profile: req.body.profile, profile: req.body.profile,
app_version: appVersion, app_version: appVersion,
lastlogin: moment().utc(), lastlogin: moment().utc(),
@ -202,7 +202,7 @@ async function register(req, res, next) {
newUser = cleanAdminData(newUser); newUser = cleanAdminData(newUser);
if (appVersion) { if (appVersion) {
if (newUser.app_version != appVersion) { if (newUser.app_version != appVersion) {
const result = userService._updateLastLoginAndVersionUser( const result = await userService._updateLastLoginAndVersionUser(
newUser.id, newUser.id,
appVersion appVersion
); );

View File

@ -59,6 +59,14 @@ const extraMethods = {
}); });
}, },
_getInscriptionByEvent: (eventId) => {
return models.EventInscription.scope("defaultScope").findAll({
where: {
eventId: eventId,
},
});
},
_getInscriptionByEventAndValidated: (eventId, validated) => { _getInscriptionByEventAndValidated: (eventId, validated) => {
return models.EventInscription.scope("defaultScope").findAll({ return models.EventInscription.scope("defaultScope").findAll({
where: { where: {