Update database schema and add signup_date, last_login, and role columns to user table

This commit is contained in:
Sean Morley
2024-04-18 01:15:52 +00:00
parent f0eb5441f0
commit 2249052ab7
10 changed files with 456 additions and 2 deletions

View File

@@ -47,7 +47,7 @@ export const actions: Actions = {
});
}
const existingUser = await db
const existingUser:any = await db
.select()
.from(userTable)
.where(eq(userTable.username, username))
@@ -70,6 +70,14 @@ export const actions: Actions = {
});
}
await db
.update(userTable)
.set({
last_login: new Date(),
})
.where(eq(userTable.id, existingUser.id))
.execute();
const session = await lucia.createSession(existingUser.id, {});
const sessionCookie = lucia.createSessionCookie(session.id);
event.cookies.set(sessionCookie.name, sessionCookie.value, {