groups api route

This commit is contained in:
2024-03-12 23:07:07 +01:00
parent 3b1e627356
commit d62cc6f6a4
21 changed files with 488 additions and 15 deletions

View File

@@ -12,7 +12,10 @@ export async function createSession(user_id: string) {
}
export async function validateSession(session_id: string) {
const session = await db.select().from(sessionsTable).where(eq(sessionsTable.id, session_id)).leftJoin(usersTable, eq(usersTable.id, sessionsTable.user_id));
return session[0].users;
try {
const session = await db.select().from(sessionsTable).where(eq(sessionsTable.id, session_id)).leftJoin(usersTable, eq(usersTable.id, sessionsTable.user_id));
return session[0].users;
} catch (e) {
return false;
}
}