16 lines
384 B
TypeScript
16 lines
384 B
TypeScript
import { prisma as db } from "@repo/db/client";
|
|
|
|
export const aiSettingsStorage = {
|
|
async getAiSettings(userId: number) {
|
|
return db.aiSettings.findUnique({ where: { userId } });
|
|
},
|
|
|
|
async upsertAiSettings(userId: number, apiKey: string) {
|
|
return db.aiSettings.upsert({
|
|
where: { userId },
|
|
update: { apiKey },
|
|
create: { userId, apiKey },
|
|
});
|
|
},
|
|
};
|