add: create, update and login dates in database

This commit is contained in:
rasmusq
2025-12-19 20:50:06 +01:00
parent 23ff65f3e7
commit ed9da14fa5
7 changed files with 43 additions and 13 deletions

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;