Reorganize repo: backend/, deploy/, docs/ layout + AGENTS.md
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.
This commit is contained in:
@@ -0,0 +1,393 @@
|
||||
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 string values.
|
||||
|
||||
// --- User & Account Enums (M1) ---
|
||||
|
||||
type UserAvailability string
|
||||
|
||||
const (
|
||||
UserAvailabilityOnline UserAvailability = "online"
|
||||
UserAvailabilityOffline UserAvailability = "offline"
|
||||
UserAvailabilityBusy UserAvailability = "busy"
|
||||
)
|
||||
|
||||
type UserType string
|
||||
|
||||
const (
|
||||
UserTypeUser UserType = "user"
|
||||
UserTypeSuperAdmin UserType = "super_admin"
|
||||
)
|
||||
|
||||
type AccountUserRole string
|
||||
|
||||
const (
|
||||
AccountUserRoleAgent AccountUserRole = "agent"
|
||||
AccountUserRoleAdministrator AccountUserRole = "administrator"
|
||||
)
|
||||
|
||||
// --- Conversation & Message Enums (M3) ---
|
||||
|
||||
type ConversationStatus string
|
||||
|
||||
const (
|
||||
ConversationStatusOpen ConversationStatus = "open"
|
||||
ConversationStatusResolved ConversationStatus = "resolved"
|
||||
ConversationStatusPending ConversationStatus = "pending"
|
||||
ConversationStatusSnoozed ConversationStatus = "snoozed"
|
||||
)
|
||||
|
||||
type ConversationPriority string
|
||||
|
||||
const (
|
||||
ConversationPriorityUrgent ConversationPriority = "urgent"
|
||||
ConversationPriorityHigh ConversationPriority = "high"
|
||||
ConversationPriorityMedium ConversationPriority = "medium"
|
||||
ConversationPriorityLow ConversationPriority = "low"
|
||||
)
|
||||
|
||||
type MessageType string
|
||||
|
||||
const (
|
||||
MessageTypeIncoming MessageType = "incoming"
|
||||
MessageTypeOutgoing MessageType = "outgoing"
|
||||
MessageTypeActivity MessageType = "activity"
|
||||
MessageTypeTemplate MessageType = "template"
|
||||
MessageTypePrivate MessageType = "private"
|
||||
)
|
||||
|
||||
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"
|
||||
)
|
||||
|
||||
type SenderType string
|
||||
|
||||
const (
|
||||
SenderTypeContact SenderType = "Contact"
|
||||
SenderTypeUser SenderType = "User"
|
||||
SenderTypeAgentBot SenderType = "AgentBot"
|
||||
)
|
||||
|
||||
type MessageStatus string
|
||||
|
||||
const (
|
||||
MessageStatusSent MessageStatus = "sent"
|
||||
MessageStatusDelivered MessageStatus = "delivered"
|
||||
MessageStatusRead MessageStatus = "read"
|
||||
MessageStatusFailed MessageStatus = "failed"
|
||||
)
|
||||
|
||||
// ConversationEventType defines domain-specific events for conversation lifecycle.
|
||||
type ConversationEventType string
|
||||
|
||||
const (
|
||||
ConversationEventCreated ConversationEventType = "created"
|
||||
ConversationEventUpdated ConversationEventType = "updated"
|
||||
ConversationEventStatusChanged ConversationEventType = "status_changed"
|
||||
ConversationEventAssigned ConversationEventType = "assigned"
|
||||
ConversationEventUnassigned ConversationEventType = "unassigned"
|
||||
ConversationEventDeleted ConversationEventType = "deleted"
|
||||
ConversationEventMuted ConversationEventType = "muted"
|
||||
ConversationEventUnmuted ConversationEventType = "unmuted"
|
||||
ConversationEventLabelsUpdated ConversationEventType = "labels_updated"
|
||||
ConversationEventPriorityUpdated ConversationEventType = "priority_updated"
|
||||
)
|
||||
|
||||
// MessageEventType defines events for message lifecycle.
|
||||
type MessageEventType string
|
||||
|
||||
const (
|
||||
MessageEventCreated MessageEventType = "created"
|
||||
MessageEventUpdated MessageEventType = "updated"
|
||||
MessageEventDeleted MessageEventType = "deleted"
|
||||
MessageEventStatusUpdated MessageEventType = "status_updated"
|
||||
)
|
||||
|
||||
// --- Channel Enums (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"
|
||||
InboxChannelTypeTwilioSMS InboxChannelType = "Channel::TwilioSms"
|
||||
InboxChannelTypeLine InboxChannelType = "Channel::Line"
|
||||
InboxChannelTypeSMS InboxChannelType = "Channel::Sms"
|
||||
InboxChannelTypeInstagram InboxChannelType = "Channel::Instagram"
|
||||
InboxChannelTypeTikTok InboxChannelType = "Channel::TikTok"
|
||||
InboxChannelTypeTwitter InboxChannelType = "Channel::Twitter"
|
||||
InboxChannelTypeMicrosoft InboxChannelType = "Channel::Microsoft"
|
||||
InboxChannelTypeGoogle InboxChannelType = "Channel::Google"
|
||||
InboxChannelTypeAPI InboxChannelType = "Channel::Api"
|
||||
)
|
||||
|
||||
type AssignmentLogic string
|
||||
|
||||
const (
|
||||
AssignmentLogicRoundRobin AssignmentLogic = "round_robin"
|
||||
AssignmentLogicLeastBusy AssignmentLogic = "least_busy"
|
||||
)
|
||||
|
||||
type ReplyTimeType string
|
||||
|
||||
const (
|
||||
ReplyTimeInAFewMinutes ReplyTimeType = "in_a_few_minutes"
|
||||
ReplyTimeInAFewHours ReplyTimeType = "in_a_few_hours"
|
||||
ReplyTimeInADay ReplyTimeType = "in_a_day"
|
||||
)
|
||||
|
||||
// --- Contact Enums (M4) ---
|
||||
|
||||
type ContactSource string
|
||||
|
||||
const (
|
||||
ContactSourceChatwoot ContactSource = "chatwoot"
|
||||
ContactSourceFacebook ContactSource = "facebook"
|
||||
ContactSourceWhatsApp ContactSource = "whatsapp"
|
||||
ContactSourceTelegram ContactSource = "telegram"
|
||||
)
|
||||
|
||||
// --- Automation Enums (M6) ---
|
||||
|
||||
type AutomationEventType string
|
||||
|
||||
const (
|
||||
AutomationEventMessageCreated AutomationEventType = "message_created"
|
||||
AutomationEventConversationCreated AutomationEventType = "conversation_created"
|
||||
AutomationEventConversationUpdated AutomationEventType = "conversation_updated"
|
||||
)
|
||||
|
||||
type MacroVisibility string
|
||||
|
||||
const (
|
||||
MacroVisibilityPersonal MacroVisibility = "personal"
|
||||
MacroVisibilityTeam MacroVisibility = "team"
|
||||
MacroVisibilityGlobal MacroVisibility = "global"
|
||||
)
|
||||
|
||||
// --- Campaign Enums (M7) ---
|
||||
|
||||
type CampaignType string
|
||||
|
||||
const (
|
||||
CampaignTypeOngoing CampaignType = "ongoing"
|
||||
CampaignTypeOneOff CampaignType = "one_off"
|
||||
)
|
||||
|
||||
// --- Notification Enums (M8) ---
|
||||
|
||||
type NotificationEventType string
|
||||
|
||||
const (
|
||||
NotificationEventConversationCreated NotificationEventType = "conversation_created"
|
||||
NotificationEventConversationAssigned NotificationEventType = "conversation_assigned"
|
||||
NotificationEventMessageCreated NotificationEventType = "message_created"
|
||||
NotificationEventConversationStatusChanged NotificationEventType = "conversation_status_changed"
|
||||
NotificationEventAssigneeChanged NotificationEventType = "assignee_changed"
|
||||
NotificationEventTeamChanged NotificationEventType = "team_changed"
|
||||
)
|
||||
|
||||
type SubscriptionType string
|
||||
|
||||
const (
|
||||
SubscriptionTypePush SubscriptionType = "push"
|
||||
SubscriptionTypeEmail SubscriptionType = "email"
|
||||
SubscriptionTypeWebPush SubscriptionType = "webpush"
|
||||
)
|
||||
|
||||
// --- Knowledge Base Enums (M9) ---
|
||||
|
||||
type ArticleStatus string
|
||||
|
||||
const (
|
||||
ArticleStatusDraft ArticleStatus = "draft"
|
||||
ArticleStatusPublished ArticleStatus = "published"
|
||||
ArticleStatusArchived ArticleStatus = "archived"
|
||||
)
|
||||
|
||||
type PortalMemberRole string
|
||||
|
||||
const (
|
||||
PortalMemberRoleReader PortalMemberRole = "reader"
|
||||
PortalMemberRoleEditor PortalMemberRole = "editor"
|
||||
PortalMemberRoleAdministrator PortalMemberRole = "administrator"
|
||||
)
|
||||
|
||||
// --- SLA Enums (M11) ---
|
||||
// Reference: Chatwoot enum sla_status: { active: 0, hit: 1, missed: 2, active_with_misses: 3 }
|
||||
|
||||
type SLAStatus string
|
||||
|
||||
const (
|
||||
SLAStatusActive SLAStatus = "active"
|
||||
SLAStatusHit SLAStatus = "hit"
|
||||
SLAStatusMissed SLAStatus = "missed"
|
||||
SLAStatusActiveWithMisses SLAStatus = "active_with_misses"
|
||||
)
|
||||
|
||||
// SLAEventType represents the type of SLA threshold event.
|
||||
// Reference: Chatwoot enum event_type: { frt: 0, nrt: 1, rt: 2 }
|
||||
type SLAEventType string
|
||||
|
||||
const (
|
||||
SLAEventFRT SLAEventType = "frt" // first response time threshold
|
||||
SLAEventNRT SLAEventType = "nrt" // next response time threshold
|
||||
SLAEventRT SLAEventType = "rt" // resolution time threshold
|
||||
)
|
||||
|
||||
type AuditAction string
|
||||
|
||||
const (
|
||||
AuditActionCreate AuditAction = "create"
|
||||
AuditActionUpdate AuditAction = "update"
|
||||
AuditActionDelete AuditAction = "delete"
|
||||
)
|
||||
|
||||
type CallType string
|
||||
|
||||
const (
|
||||
CallTypeInbound CallType = "inbound"
|
||||
CallTypeOutbound CallType = "outbound"
|
||||
)
|
||||
|
||||
type CallStatus string
|
||||
|
||||
const (
|
||||
CallStatusRinging CallStatus = "ringing"
|
||||
CallStatusOngoing CallStatus = "ongoing"
|
||||
CallStatusCompleted CallStatus = "completed"
|
||||
CallStatusFailed CallStatus = "failed"
|
||||
)
|
||||
|
||||
// --- Copilot Enums (M10) ---
|
||||
// NOTE: CopilotMessageType is defined in captain_models.go with user/assistant/assistant_thinking values.
|
||||
// The enums below provide additional copilot-related constants.
|
||||
|
||||
type CopilotRole string
|
||||
|
||||
const (
|
||||
CopilotRoleUser CopilotRole = "user"
|
||||
CopilotRoleAssistant CopilotRole = "assistant"
|
||||
CopilotRoleTool CopilotRole = "tool"
|
||||
)
|
||||
|
||||
// CopilotMessageType is defined in captain_models.go (user/assistant/assistant_thinking).
|
||||
// CopilotFeatureType defines the feature categories for copilot suggestions.
|
||||
|
||||
// --- Platform Enums (M12) ---
|
||||
|
||||
type DataImportStatus string
|
||||
|
||||
const (
|
||||
DataImportStatusPending DataImportStatus = "pending"
|
||||
DataImportStatusProcessing DataImportStatus = "processing"
|
||||
DataImportStatusCompleted DataImportStatus = "completed"
|
||||
DataImportStatusFailed DataImportStatus = "failed"
|
||||
)
|
||||
|
||||
// --- Custom Attribute Enums (M4) ---
|
||||
|
||||
type AttributeModelType string
|
||||
|
||||
const (
|
||||
AttributeModelConversation AttributeModelType = "conversation"
|
||||
AttributeModelContact AttributeModelType = "contact"
|
||||
)
|
||||
|
||||
type AttributeValueType string
|
||||
|
||||
const (
|
||||
AttributeValueTypeText AttributeValueType = "text"
|
||||
AttributeValueTypeNumber AttributeValueType = "number"
|
||||
AttributeValueTypeDate AttributeValueType = "date"
|
||||
AttributeValueTypeList AttributeValueType = "list"
|
||||
AttributeValueTypeCheckbox AttributeValueType = "checkbox"
|
||||
)
|
||||
|
||||
// --- Filter Enums (M4) ---
|
||||
|
||||
type FilterType string
|
||||
|
||||
const (
|
||||
FilterTypeConversation FilterType = "conversation"
|
||||
FilterTypeContact FilterType = "contact"
|
||||
FilterTypeInbox FilterType = "inbox"
|
||||
FilterTypeMessage FilterType = "message"
|
||||
)
|
||||
|
||||
// --- Reporting Enums (M7) ---
|
||||
|
||||
type RollupType string
|
||||
|
||||
const (
|
||||
RollupTypeDaily RollupType = "daily"
|
||||
RollupTypeWeekly RollupType = "weekly"
|
||||
RollupTypeMonthly RollupType = "monthly"
|
||||
)
|
||||
|
||||
// --- Captain Enums (M10) ---
|
||||
|
||||
type CaptainDocumentStatus string
|
||||
|
||||
const (
|
||||
CaptainDocumentStatusInProgress CaptainDocumentStatus = "in_progress"
|
||||
CaptainDocumentStatusCompleted CaptainDocumentStatus = "completed"
|
||||
CaptainDocumentStatusFailed CaptainDocumentStatus = "failed"
|
||||
)
|
||||
|
||||
type HookType string
|
||||
|
||||
const (
|
||||
HookTypeInboxOutgoing HookType = "inbox_outgoing"
|
||||
HookTypeAccountOutgoing HookType = "account_outgoing"
|
||||
// M11: Integration hook types (webhook/slack/shopify/linear/notion)
|
||||
HookTypeWebhook HookType = "webhook"
|
||||
HookTypeSlack HookType = "slack"
|
||||
HookTypeShopify HookType = "shopify"
|
||||
HookTypeLinear HookType = "linear"
|
||||
HookTypeNotion HookType = "notion"
|
||||
)
|
||||
|
||||
type HookStatus string
|
||||
|
||||
const (
|
||||
HookStatusActive HookStatus = "active"
|
||||
HookStatusDisabled HookStatus = "disabled"
|
||||
HookStatusInactive HookStatus = "inactive"
|
||||
)
|
||||
|
||||
// --- WhatsApp Provider ---
|
||||
|
||||
type WhatsAppProvider string
|
||||
|
||||
const (
|
||||
WhatsAppProvider360Dialog WhatsAppProvider = "360dialog"
|
||||
WhatsAppProviderWhatsAppCloud WhatsAppProvider = "whatsapp_cloud"
|
||||
)
|
||||
|
||||
// --- Twilio Medium ---
|
||||
|
||||
type TwilioMedium string
|
||||
|
||||
const (
|
||||
TwilioMediumSMS TwilioMedium = "sms"
|
||||
TwilioMediumWhatsApp TwilioMedium = "whatsapp"
|
||||
)
|
||||
Reference in New Issue
Block a user