tx
This commit is contained in:
parent
b5424fc83b
commit
39918459ab
@ -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;
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user