import db from "@/db/db"; import { emailLogs } from "@/db/schema/emailLogs"; export type CreateEmailLogParams = { from: string; to: string; cc?: string | string[]; subject: string; }; export async function createEmailLog(params: CreateEmailLogParams): Promise { const { from, to, cc, subject } = params; const ccValue = Array.isArray(cc) ? cc.join(", ") : cc ?? null; await db.insert(emailLogs).values({ from, to, cc: ccValue ?? undefined, subject, }); }