Add SMTP send flow for approved outreach
This commit is contained in:
@@ -56,6 +56,10 @@ const outreachSendStatus = v.union(
|
||||
v.literal("sent"),
|
||||
v.literal("failed"),
|
||||
);
|
||||
const outreachSendAttemptStatus = v.union(
|
||||
v.literal("success"),
|
||||
v.literal("failed"),
|
||||
);
|
||||
const outreachResponseStatus = v.union(
|
||||
v.literal("none"),
|
||||
v.literal("manual_reply_recorded"),
|
||||
@@ -500,6 +504,33 @@ export default defineSchema({
|
||||
.index("by_sendStatus", ["sendStatus"])
|
||||
.index("by_sendStatus_and_updatedAt", ["sendStatus", "updatedAt"]),
|
||||
|
||||
outreachSendAttempts: defineTable({
|
||||
outreachId: v.id("outreachRecords"),
|
||||
leadId: v.id("leads"),
|
||||
auditId: v.optional(v.id("audits")),
|
||||
recipient: v.string(),
|
||||
subject: v.string(),
|
||||
body: v.string(),
|
||||
sender: v.string(),
|
||||
auditLink: v.optional(v.union(v.string(), v.null())),
|
||||
status: outreachSendAttemptStatus,
|
||||
sentAt: v.optional(v.number()),
|
||||
smtpMessageId: v.optional(v.string()),
|
||||
smtpResponse: v.optional(v.string()),
|
||||
smtpAccepted: v.optional(v.array(v.string())),
|
||||
smtpRejected: v.optional(v.array(v.string())),
|
||||
errorMessage: v.optional(v.string()),
|
||||
errorCode: v.optional(v.string()),
|
||||
errorResponseCode: v.optional(v.number()),
|
||||
errorResponse: v.optional(v.string()),
|
||||
createdAt: v.number(),
|
||||
updatedAt: v.number(),
|
||||
})
|
||||
.index("by_outreachId", ["outreachId"])
|
||||
.index("by_leadId", ["leadId"])
|
||||
.index("by_status", ["status"])
|
||||
.index("by_createdAt", ["createdAt"]),
|
||||
|
||||
blacklistEntries: defineTable({
|
||||
type: blacklistType,
|
||||
value: v.string(),
|
||||
|
||||
Reference in New Issue
Block a user