fix: clear email attachments after send (#258)

This commit is contained in:
KM Koushik
2025-09-27 06:30:33 +10:00
committed by GitHub
parent 10fc285dcb
commit 014199201b
@@ -7,7 +7,6 @@ import { db } from "../db";
import { sendRawEmail } from "../aws/ses"; import { sendRawEmail } from "../aws/ses";
import { getRedis } from "../redis"; import { getRedis } from "../redis";
import { DEFAULT_QUEUE_OPTIONS } from "../queue/queue-constants"; import { DEFAULT_QUEUE_OPTIONS } from "../queue/queue-constants";
import { Prisma } from "@prisma/client";
import { logger } from "../logger/log"; import { logger } from "../logger/log";
import { createWorkerHandler, TeamJob } from "../queue/bullmq-context"; import { createWorkerHandler, TeamJob } from "../queue/bullmq-context";
import { LimitService } from "./limit-service"; import { LimitService } from "./limit-service";
@@ -418,7 +417,7 @@ async function executeEmail(job: QueueEmailJob) {
// Delete attachments after sending the email // Delete attachments after sending the email
await db.email.update({ await db.email.update({
where: { id: email.id }, where: { id: email.id },
data: { sesEmailId: messageId, text, attachments: undefined }, data: { sesEmailId: messageId, text, attachments: null },
}); });
} catch (error: any) { } catch (error: any) {
await db.emailEvent.create({ await db.emailEvent.create({