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 });
if (user) {
user = user.toJSON();
const result = userService._updateLastLoginAndVersionUser(
userService._updateLastLoginAndVersionUser(
user.id,
appVersion
);

View File

@ -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;
}

View File

@ -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
);

View File

@ -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: {