import { getDb, Client } from "../index"; import { Collection } from "mongodb"; export const getClientsCollection = (): Collection => { return getDb().collection("clients"); }; export const getClientByAPIKey = async ( apiKey: string, ): Promise => { const client = await getClientsCollection().findOne({ apiKey, isActive: true, }); return client ? client : null; };