Update database schema and add signup_date, last_login, and role columns to user table
This commit is contained in:
@@ -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, {
|
||||
|
||||
Reference in New Issue
Block a user