Restructure the monorepo into clear top-level directories: - backend/: Go module root (cmd, internal, pkg, configs, migrations, docs/swagger, scripts, tests, go.mod, Makefile, .air.toml) - deploy/: Docker (Dockerfile, docker-compose*), quickstart, fluentd - docs/: project documentation + reports/ (moved from repo root) - AGENTS.md: new AI coding-agent guide at repo root Update all references to the new layout: - Dockerfile: COPY backend/go.mod, COPY backend/ (context = repo root) - docker-compose files: context ../.., dockerfile deploy/docker/Dockerfile, env_file ../../.env, volume mounts ../../backend:/app - deploy/quickstart/compose.yaml: dockerfile deploy/docker/Dockerfile - CI: working-directory: backend for go commands, file deploy/docker/Dockerfile, coverage path backend/coverage.out, health_check backend/scripts/ - backend/Makefile: docker target uses -f ../deploy/docker/Dockerfile ../ - README: architecture tree, quickstart, config paths updated Move root stray scripts (rename_models.*, run_m11_tests.sh, verify_build.sh, gorm_bool_main.go) to backend/scripts/legacy/. All moves via git mv to preserve history. Build, vet, SQLite tests, and docker compose config verified.
312 lines
9.7 KiB
Plaintext
312 lines
9.7 KiB
Plaintext
package model
|
|
|
|
// Enums defines string constants for all GoChat model enum fields.
|
|
// Pattern: Go string constants instead of Rails integer flags.
|
|
// Reference: Chatwoot uses integer enums; GoChat uses descriptive strings.
|
|
|
|
// --- Inbox Channel Types (M2) ---
|
|
type InboxChannelType string
|
|
|
|
const (
|
|
InboxChannelTypeWebWidget InboxChannelType = "Channel::WebWidget"
|
|
InboxChannelTypeTelegram InboxChannelType = "Channel::Telegram"
|
|
InboxChannelTypeFacebook InboxChannelType = "Channel::FacebookPage"
|
|
InboxChannelTypeWhatsapp InboxChannelType = "Channel::Whatsapp"
|
|
InboxChannelTypeEmail InboxChannelType = "Channel::Email"
|
|
InboxChannelTypeAPI InboxChannelType = "Channel::Api"
|
|
InboxChannelTypeTwilioSMS InboxChannelType = "Channel::TwilioSms"
|
|
InboxChannelTypeLine InboxChannelType = "Channel::Line"
|
|
InboxChannelTypeSms InboxChannelType = "Channel::Sms"
|
|
InboxChannelTypeInstagram InboxChannelType = "Channel::Instagram"
|
|
InboxChannelTypeTiktok InboxChannelType = "Channel::Tiktok"
|
|
)
|
|
|
|
// --- Conversation Status (M3) ---
|
|
type ConversationStatus string
|
|
|
|
const (
|
|
ConversationStatusOpen ConversationStatus = "open"
|
|
ConversationStatusResolved ConversationStatus = "resolved"
|
|
ConversationStatusPending ConversationStatus = "pending"
|
|
ConversationStatusSnoozed ConversationStatus = "snoozed"
|
|
)
|
|
|
|
// --- Conversation Priority (M3) ---
|
|
type ConversationPriority string
|
|
|
|
const (
|
|
ConversationPriorityUrgent ConversationPriority = "urgent"
|
|
ConversationPriorityHigh ConversationPriority = "high"
|
|
ConversationPriorityMedium ConversationPriority = "medium"
|
|
ConversationPriorityLow ConversationPriority = "low"
|
|
)
|
|
|
|
// --- Message Content Types (M3) ---
|
|
type MessageContentType string
|
|
|
|
const (
|
|
MessageContentTypeText MessageContentType = "text"
|
|
MessageContentTypeInputText MessageContentType = "input_text"
|
|
MessageContentTypeInputEmail MessageContentType = "input_email"
|
|
MessageContentTypeImage MessageContentType = "image"
|
|
MessageContentTypeAudio MessageContentType = "audio"
|
|
MessageContentTypeVideo MessageContentType = "video"
|
|
MessageContentTypeFile MessageContentType = "file"
|
|
MessageContentTypeLocation MessageContentType = "location"
|
|
MessageContentTypeEmoji MessageContentType = "emoji"
|
|
MessageContentTypeExtended MessageContentType = "extended"
|
|
MessageContentTypeQuote MessageContentType = "quote"
|
|
MessageContentTypeContact MessageContentType = "contact"
|
|
)
|
|
|
|
// --- Message Types (M3) ---
|
|
type MessageType string
|
|
|
|
const (
|
|
MessageTypeIncoming MessageType = "incoming"
|
|
MessageTypeOutgoing MessageType = "outgoing"
|
|
MessageTypeActivity MessageType = "activity"
|
|
MessageTypeTemplate MessageType = "template"
|
|
MessageTypePrivate MessageType = "private"
|
|
)
|
|
|
|
// --- Message Sender Types (M3) ---
|
|
type SenderType string
|
|
|
|
const (
|
|
SenderTypeContact SenderType = "Contact"
|
|
SenderTypeUser SenderType = "User"
|
|
SenderTypeAgentBot SenderType = "AgentBot"
|
|
)
|
|
|
|
// --- Message Status (M3) ---
|
|
type MessageStatus string
|
|
|
|
const (
|
|
MessageStatusSent MessageStatus = "sent"
|
|
MessageStatusDelivered MessageStatus = "delivered"
|
|
MessageStatusRead MessageStatus = "read"
|
|
MessageStatusFailed MessageStatus = "failed"
|
|
)
|
|
|
|
// --- Attachment File Types (M3) ---
|
|
type AttachmentFileType string
|
|
|
|
const (
|
|
AttachmentFileTypeImage AttachmentFileType = "image"
|
|
AttachmentFileTypeAudio AttachmentFileType = "audio"
|
|
AttachmentFileTypeVideo AttachmentFileType = "video"
|
|
AttachmentFileTypeFile AttachmentFileType = "file"
|
|
AttachmentFileTypeLocation AttachmentFileType = "location"
|
|
AttachmentFileTypeEmoji AttachmentFileType = "emoji"
|
|
AttachmentFileTypeContact AttachmentFileType = "contact"
|
|
)
|
|
|
|
// --- AccountUser Roles (M1) ---
|
|
type AccountUserRole string
|
|
|
|
const (
|
|
AccountUserRoleAgent AccountUserRole = "agent"
|
|
AccountUserRoleAdmin AccountUserRole = "administrator"
|
|
AccountUserRoleSupervisor AccountUserRole = "supervisor"
|
|
)
|
|
|
|
// --- User Availability (M1) ---
|
|
type UserAvailability string
|
|
|
|
const (
|
|
UserAvailabilityOnline UserAvailability = "online"
|
|
UserAvailabilityOffline UserAvailability = "offline"
|
|
UserAvailabilityBusy UserAvailability = "busy"
|
|
)
|
|
|
|
// --- Contact Type (M4) ---
|
|
type ContactType string
|
|
|
|
const (
|
|
ContactTypeContact ContactType = "contact"
|
|
ContactTypeMyContact ContactType = "my_contact"
|
|
)
|
|
|
|
// --- Automation Rule Event Types (M6) ---
|
|
type AutomationEventType string
|
|
|
|
const (
|
|
AutomationEventTypeConversationCreated AutomationEventType = "conversation_created"
|
|
AutomationEventTypeConversationUpdated AutomationEventType = "conversation_updated"
|
|
AutomationEventTypeMessageCreated AutomationEventType = "message_created"
|
|
)
|
|
|
|
// --- Automation Action Types (M6) ---
|
|
type AutomationActionType string
|
|
|
|
const (
|
|
AutomationActionTypeSendMessage AutomationActionType = "send_message"
|
|
AutomationActionTypeUpdateStatus AutomationActionType = "update_status"
|
|
AutomationActionTypeAssignAgent AutomationActionType = "assign_agent"
|
|
AutomationActionTypeAssignTeam AutomationActionType = "assign_team"
|
|
AutomationActionTypeAddLabel AutomationActionType = "add_label"
|
|
AutomationActionTypeWebhook AutomationActionType = "webhook"
|
|
)
|
|
|
|
// --- Report Types (M7) ---
|
|
type ReportType string
|
|
|
|
const (
|
|
ReportTypeConversation ReportType = "conversation"
|
|
ReportTypeAgent ReportType = "agent"
|
|
ReportTypeInbox ReportType = "inbox"
|
|
ReportTypeTeam ReportType = "team"
|
|
)
|
|
|
|
// --- Notification Types (M8) ---
|
|
type NotificationType string
|
|
|
|
const (
|
|
NotificationTypeConversationCreated NotificationType = "conversation_created"
|
|
NotificationTypeConversationAssigned NotificationType = "conversation_assigned"
|
|
NotificationTypeMessageCreated NotificationType = "message_created"
|
|
NotificationTypeAssignedConversationNewMessage NotificationType = "assigned_conversation_new_message"
|
|
)
|
|
|
|
// --- Article Status (M9) ---
|
|
type ArticleStatus string
|
|
|
|
const (
|
|
ArticleStatusDraft ArticleStatus = "draft"
|
|
ArticleStatusPublished ArticleStatus = "published"
|
|
ArticleStatusArchived ArticleStatus = "archived"
|
|
)
|
|
|
|
// --- Portal Member Roles (M9) ---
|
|
type PortalMemberRole string
|
|
|
|
const (
|
|
PortalMemberRoleReader PortalMemberRole = "reader"
|
|
PortalMemberRoleEditor PortalMemberRole = "editor"
|
|
PortalMemberRoleAdministrator PortalMemberRole = "administrator"
|
|
)
|
|
|
|
// --- SLA Event Types (M11) ---
|
|
type SlaEventType string
|
|
|
|
const (
|
|
SlaEventTypeFirstResponseMissed SlaEventType = "first_response_missed"
|
|
SlaEventTypeNextResponseMissed SlaEventType = "next_response_missed"
|
|
SlaEventTypeResolutionMissed SlaEventType = "resolution_missed"
|
|
SlaEventTypeFirstResponseMet SlaEventType = "first_response_met"
|
|
SlaEventTypeNextResponseMet SlaEventType = "next_response_met"
|
|
SlaEventTypeResolutionMet SlaEventType = "resolution_met"
|
|
)
|
|
|
|
// --- Call Status (M11) ---
|
|
type CallStatus string
|
|
|
|
const (
|
|
CallStatusRinging CallStatus = "ringing"
|
|
CallStatusOngoing CallStatus = "ongoing"
|
|
CallStatusCompleted CallStatus = "completed"
|
|
CallStatusFailed CallStatus = "failed"
|
|
CallStatusMissed CallStatus = "missed"
|
|
)
|
|
|
|
// --- Call Direction (M11) ---
|
|
type CallDirection string
|
|
|
|
const (
|
|
CallDirectionInbound CallDirection = "inbound"
|
|
CallDirectionOutbound CallDirection = "outbound"
|
|
)
|
|
|
|
// --- Data Import Source Types (M12) ---
|
|
type DataImportSourceType string
|
|
|
|
const (
|
|
DataImportSourceCSV DataImportSourceType = "csv"
|
|
DataImportSourceChatwoot DataImportSourceType = "chatwoot"
|
|
DataImportSourceZendesk DataImportSourceType = "zendesk"
|
|
DataImportSourceFreshdesk DataImportSourceType = "freshdesk"
|
|
)
|
|
|
|
// --- Data Import Status (M12) ---
|
|
type DataImportStatus string
|
|
|
|
const (
|
|
DataImportStatusPending DataImportStatus = "pending"
|
|
DataImportStatusProcessing DataImportStatus = "processing"
|
|
DataImportStatusCompleted DataImportStatus = "completed"
|
|
DataImportStatusFailed DataImportStatus = "failed"
|
|
)
|
|
|
|
// --- Captain AI Response Status (M10) ---
|
|
type CaptainResponseStatus string
|
|
|
|
const (
|
|
CaptainResponseStatusSuggested CaptainResponseStatus = "suggested"
|
|
CaptainResponseStatusDismissed CaptainResponseStatus = "dismissed"
|
|
CaptainResponseStatusAccepted CaptainResponseStatus = "accepted"
|
|
)
|
|
|
|
// --- Captain Document Status (M10) ---
|
|
type CaptainDocumentStatus string
|
|
|
|
const (
|
|
CaptainDocumentStatusProcessing CaptainDocumentStatus = "processing"
|
|
CaptainDocumentStatusReady CaptainDocumentStatus = "ready"
|
|
CaptainDocumentStatusError CaptainDocumentStatus = "error"
|
|
)
|
|
|
|
// --- Copilot Message Roles (M10) ---
|
|
type CopilotMessageRole string
|
|
|
|
const (
|
|
CopilotMessageRoleUser CopilotMessageRole = "user"
|
|
CopilotMessageRoleAssistant CopilotMessageRole = "assistant"
|
|
CopilotMessageRoleSystem CopilotMessageRole = "system"
|
|
)
|
|
|
|
// --- Audit Actions (M11) ---
|
|
type AuditAction string
|
|
|
|
const (
|
|
AuditActionCreate AuditAction = "create"
|
|
AuditActionUpdate AuditAction = "update"
|
|
AuditActionDelete AuditAction = "delete"
|
|
AuditActionAssign AuditAction = "assign"
|
|
AuditActionUnassign AuditAction = "unassign"
|
|
)
|
|
|
|
// --- Push Token Platforms (M8) ---
|
|
type PushTokenPlatform string
|
|
|
|
const (
|
|
PushTokenPlatformIOS PushTokenPlatform = "ios"
|
|
PushTokenPlatformAndroid PushTokenPlatform = "android"
|
|
PushTokenPlatformWeb PushTokenPlatform = "web"
|
|
)
|
|
|
|
// --- Notification Channels (M8) ---
|
|
type NotificationChannel string
|
|
|
|
const (
|
|
NotificationChannelEmail NotificationChannel = "email"
|
|
NotificationChannelPush NotificationChannel = "push"
|
|
NotificationChannelBrowser NotificationChannel = "browser"
|
|
)
|
|
|
|
// --- Banner Types (M12) ---
|
|
type BannerType string
|
|
|
|
const (
|
|
BannerTypeInfo BannerType = "info"
|
|
BannerTypeWarning BannerType = "warning"
|
|
BannerTypeCritical BannerType = "critical"
|
|
)
|
|
|
|
// --- Dashboard App Kinds (M12) ---
|
|
type DashboardAppKind string
|
|
|
|
const (
|
|
DashboardAppKindIframe DashboardAppKind = "iframe"
|
|
DashboardAppKindLink DashboardAppKind = "link"
|
|
) |