feat: log outbound SMS and show history in compose modal
Persist manual, campaign, and automation SMS; expose history APIs for people and leads. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -202,6 +202,7 @@ model Organization {
|
||||
apiKeys OrganizationApiKey[]
|
||||
webhookEndpoints WebhookEndpoint[]
|
||||
smsCampaigns SmsCampaign[]
|
||||
outboundSmsLogs OutboundSmsLog[]
|
||||
wooCommerceConnections WooCommerceConnection[]
|
||||
montifyConnections MontifyConnection[]
|
||||
voipConnections VoipConnection[]
|
||||
@@ -541,6 +542,7 @@ model Person {
|
||||
trackingLinks TrackingLink[]
|
||||
trackingEvents TrackingEvent[]
|
||||
routineTasks RoutineTask[]
|
||||
outboundSmsLogs OutboundSmsLog[]
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
@@ -1989,6 +1991,31 @@ model WebhookDelivery {
|
||||
@@index([endpointId, createdAt])
|
||||
}
|
||||
|
||||
/// لاگ یکپارچهٔ پیامک خروجی (دستی / کمپین / اتوماسیون)
|
||||
model OutboundSmsLog {
|
||||
id String @id @default(cuid())
|
||||
organizationId String
|
||||
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
|
||||
personId String?
|
||||
person Person? @relation(fields: [personId], references: [id], onDelete: SetNull)
|
||||
leadId String?
|
||||
lead Lead? @relation(fields: [leadId], references: [id], onDelete: SetNull)
|
||||
mobile String
|
||||
body String
|
||||
/// manual | campaign | automation
|
||||
source String
|
||||
sourceId String?
|
||||
/// sent | failed
|
||||
status String
|
||||
error String?
|
||||
actorUserId String?
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
@@index([organizationId, personId, createdAt])
|
||||
@@index([organizationId, leadId, createdAt])
|
||||
@@index([organizationId, createdAt])
|
||||
}
|
||||
|
||||
/// کمپین پیامک گروهی
|
||||
model SmsCampaign {
|
||||
id String @id @default(cuid())
|
||||
@@ -2459,6 +2486,7 @@ model Lead {
|
||||
trackingEvents TrackingEvent[]
|
||||
routineTasks RoutineTask[]
|
||||
activities Activity[]
|
||||
outboundSmsLogs OutboundSmsLog[]
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
|
||||
Reference in New Issue
Block a user