Add internal org chat (phase 1) with DM, groups, and org settings.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -207,6 +207,8 @@ model Organization {
|
||||
leadStages LeadStage[]
|
||||
leadEvents LeadEvent[]
|
||||
leadImportJobs LeadImportJob[]
|
||||
conversationSettings ConversationSettings?
|
||||
conversationRooms ConversationRoom[]
|
||||
}
|
||||
|
||||
model User {
|
||||
@@ -2060,3 +2062,36 @@ model LeadImportJob {
|
||||
@@index([organizationId, status, createdAt])
|
||||
@@index([status, createdAt])
|
||||
}
|
||||
|
||||
/// تنظیمات اتصال به سرویس گفتگوی خارجی (هر محیط CRM)
|
||||
model ConversationSettings {
|
||||
organizationId String @id
|
||||
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
|
||||
chatHost String
|
||||
apiKeyCipher String
|
||||
apiKeyIv String
|
||||
apiKeyTag String
|
||||
uploadUrl String @default("")
|
||||
downloadUrl String @default("")
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
}
|
||||
|
||||
/// نگاشت roomهای سرویس چت (DM dedup و گروههای ساختهشده از CRM)
|
||||
model ConversationRoom {
|
||||
id String @id @default(cuid())
|
||||
organizationId String
|
||||
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
|
||||
externalRoomId String
|
||||
kind String
|
||||
name String?
|
||||
dmUserMinId String?
|
||||
dmUserMaxId String?
|
||||
createdByUserId String?
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
@@unique([organizationId, externalRoomId])
|
||||
@@unique([organizationId, dmUserMinId, dmUserMaxId])
|
||||
@@index([organizationId, kind])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user