diff --git a/migrations/040-last-active.sql b/migrations/040-last-active.sql new file mode 100644 index 00000000..9ccc0f11 --- /dev/null +++ b/migrations/040-last-active.sql @@ -0,0 +1,6 @@ +-- Up + +ALTER TABLE users ADD COLUMN lastActive INTEGER NULL; + +-- Down + diff --git a/server/routes/user.js b/server/routes/user.js index f592c427..9b867085 100644 --- a/server/routes/user.js +++ b/server/routes/user.js @@ -176,6 +176,9 @@ const reloadUser = async (req, res, next) => { return; } + console.log('reloadUser'); + await req.db.get(SQL`UPDATE users SET lastActive = ${+new Date} WHERE id = ${req.user.id}`); + if (req.user.username !== dbUser.username || req.user.email !== dbUser.email || req.user.roles !== dbUser.roles