add: create, update and login dates in database

This commit is contained in:
rasmusq
2025-12-19 20:50:06 +01:00
parent d51000ae7c
commit e1ddf1e5c9
7 changed files with 43 additions and 13 deletions
+8
View File
@@ -103,6 +103,14 @@ const authConfig: SvelteKitAuthConfig = {
signIn: '/signin'
},
callbacks: {
async signIn({ user }) {
if (user?.id) {
await db.update(users)
.set({ lastLogin: new Date() })
.where(eq(users.id, user.id));
}
return true;
},
async jwt({ token, user }) {
if (user) {
token.id = user.id;