blob: bb11aed99b3f4d0dfadac7570762c33e6824091f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
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<void> {
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,
});
}
|