.
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 });
|
let user = await authService.extraMethods.findUser({ id: result.id });
|
||||||
if (user) {
|
if (user) {
|
||||||
user = user.toJSON();
|
user = user.toJSON();
|
||||||
if (appVersion) {
|
const result = userService._updateLastLoginAndVersionUser(user.id, appVersion);
|
||||||
if (user.app_version != appVersion){
|
user.app_version = appVersion;
|
||||||
const result = userService._updateLastLoginAndVersionUser(user.id, appVersion);
|
|
||||||
user.app_version = appVersion;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
delete user.password;
|
delete user.password;
|
||||||
console.log('Logged in Successfully');
|
console.log('Logged in Successfully');
|
||||||
return done(null, user, { message: '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.Comments = User.hasMany(models.Comment, { foreignKey: 'userId' });
|
||||||
User.EventsReservations = User.hasMany(models.EventReservation, { foreignKey: 'userId' });
|
User.EventsReservations = User.hasMany(models.EventReservation, { foreignKey: 'userId' });
|
||||||
User.EventsInscriptions = User.hasMany(models.EventInscription, { 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.InscriptionsValidate = User.hasMany(models.EventIncription, { foreignkey: 'validateUserId'})
|
||||||
//User.Reactions = User.hasMany(models.UserReaction, { foreignKey: 'UserId' });
|
//User.Reactions = User.hasMany(models.UserReaction, { foreignKey: 'UserId' });
|
||||||
|
|||||||
@ -26,14 +26,13 @@ const extraMethods = {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateLastLoginAndVersionUser: async (Id, appVersion) => {
|
_updateLastLoginAndVersionUser: async (id, appVersion) => {
|
||||||
return models.User.update (
|
return models.User.update ({
|
||||||
{ app_version : appVersion,
|
app_version : appVersion,
|
||||||
lastlogin: moment().utc() },
|
lastlogin: moment().utc()
|
||||||
{
|
}, {
|
||||||
where: { id: Id}
|
where: { id: id }
|
||||||
},
|
});
|
||||||
);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_getOrCreateUser: async (dataUser) => {
|
_getOrCreateUser: async (dataUser) => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user