9 lines
270 B
TypeScript
9 lines
270 B
TypeScript
import client from "@/lib/mongodb";
|
|
import {Code} from "@/interfaces/user";
|
|
|
|
const db = client.db(process.env.MONGODB_DB);
|
|
|
|
export const getUserCodes = async (id: string): Promise<Code[]> => {
|
|
return await db.collection("codes").find<Code>({creator: id}).toArray();
|
|
};
|