This commit is contained in:
Omer Sabic 2024-06-08 15:12:39 +02:00
parent b5424fc83b
commit 39918459ab
2 changed files with 4 additions and 4 deletions

View File

@ -73,7 +73,7 @@ export const authRoutes = (fastify, _, done) => {
access_token: token.access_token,
refresh_token: token.refresh_token,
expires_at: new Date(token.expires_at)
});
}, tx);
console.log("SESSION MADE")
session_id = session_info.session_id;

View File

@ -13,9 +13,9 @@ export async function createSession(user_id, {
access_token,
refresh_token,
expires_at,
}) {
}, tx = db) {
try {
const [existing_session] = await db.select().from(sessions).where(eq(sessions.user_id, user_id));
const [existing_session] = await tx.select().from(sessions).where(eq(sessions.user_id, user_id));
if (existing_session) {
return {
@ -23,7 +23,7 @@ export async function createSession(user_id, {
}
}
const token = await db.insert(sessions).values({
const token = await tx.insert(sessions).values({
user_id,
access_token: access_token,
refresh_token: refresh_token,