Continued creating the entity system
This commit is contained in:
11
src/utils/sessions.be.ts
Normal file
11
src/utils/sessions.be.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import {Session} from "@/hooks/useSessions";
|
||||
import client from "@/lib/mongodb";
|
||||
|
||||
const db = client.db(process.env.MONGODB_DB);
|
||||
|
||||
export const getSessionsByUser = async (id: string, limit?: number) =>
|
||||
await db
|
||||
.collection("sessions")
|
||||
.find<Session>({user: id})
|
||||
.limit(limit || 0)
|
||||
.toArray();
|
||||
Reference in New Issue
Block a user