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();
};
