From e9f707b10b81d9759243473dd03fa463573d0772 Mon Sep 17 00:00:00 2001 From: 0-Zz-ang Date: Fri, 26 Sep 2025 16:45:59 +0900 Subject: (박서영)이메일발신인조회페이지 생성 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/mail/email-log.ts | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 lib/mail/email-log.ts (limited to 'lib/mail/email-log.ts') diff --git a/lib/mail/email-log.ts b/lib/mail/email-log.ts new file mode 100644 index 00000000..bb11aed9 --- /dev/null +++ b/lib/mail/email-log.ts @@ -0,0 +1,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 { + 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, + }); +} + + -- cgit v1.2.3