.
This commit is contained in:
parent
d494a73dc6
commit
454e5ec749
@ -116,12 +116,9 @@ passport.use('jwt', new CustomStrategy(async (req, done) => {
|
||||
let user = await authService.extraMethods.findUser({ id: result.id });
|
||||
if (user) {
|
||||
user = user.toJSON();
|
||||
if (appVersion) {
|
||||
if (user.app_version != appVersion){
|
||||
const result = userService._updateLastLoginAndVersionUser(user.id, appVersion);
|
||||
user.app_version = appVersion;
|
||||
}
|
||||
}
|
||||
const result = userService._updateLastLoginAndVersionUser(user.id, appVersion);
|
||||
user.app_version = appVersion;
|
||||
|
||||
delete user.password;
|
||||
console.log('Logged in Successfully');
|
||||
return done(null, user, { message: 'Logged in Successfully' });
|
||||
|
||||
@ -77,7 +77,7 @@ module.exports = function (sequelize, DataTypes) {
|
||||
User.Comments = User.hasMany(models.Comment, { foreignKey: 'userId' });
|
||||
User.EventsReservations = User.hasMany(models.EventReservation, { foreignKey: 'userId' });
|
||||
User.EventsInscriptions = User.hasMany(models.EventInscription, { foreignKey: 'userId' });
|
||||
User.Questions = User.hasMany(models.EventQuestion, { foreignKey: 'userId', as: "questions", required: false, });
|
||||
User.Questions = User.hasMany(models.EventQuestion, { foreignKey: 'userId', as: "questions", required: false });
|
||||
|
||||
// User.InscriptionsValidate = User.hasMany(models.EventIncription, { foreignkey: 'validateUserId'})
|
||||
//User.Reactions = User.hasMany(models.UserReaction, { foreignKey: 'UserId' });
|
||||
|
||||
@ -26,14 +26,13 @@ const extraMethods = {
|
||||
})
|
||||
},
|
||||
|
||||
_updateLastLoginAndVersionUser: async (Id, appVersion) => {
|
||||
return models.User.update (
|
||||
{ app_version : appVersion,
|
||||
lastlogin: moment().utc() },
|
||||
{
|
||||
where: { id: Id}
|
||||
},
|
||||
);
|
||||
_updateLastLoginAndVersionUser: async (id, appVersion) => {
|
||||
return models.User.update ({
|
||||
app_version : appVersion,
|
||||
lastlogin: moment().utc()
|
||||
}, {
|
||||
where: { id: id }
|
||||
});
|
||||
},
|
||||
|
||||
_getOrCreateUser: async (dataUser) => {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user