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,52 @@
|
||||
package model
|
||||
|
||||
// Inbox represents a channel inbox that groups conversations.
|
||||
// Reference: Chatwoot app/models/inbox.rb
|
||||
//
|
||||
// Chatwoot inbox attributes (permitted_params in InboxesController):
|
||||
//
|
||||
// name, avatar, greeting_enabled, greeting_message, enable_email_collect,
|
||||
// csat_survey_enabled, enable_auto_assignment, working_hours_enabled,
|
||||
// out_of_office_message, timezone, allow_messages_after_resolved,
|
||||
// lock_to_single_conversation, portal_id, sender_name_type, business_name,
|
||||
// csat_config (nested hash)
|
||||
//
|
||||
// Additional Chatwoot fields not in permitted_params but in model:
|
||||
//
|
||||
// channel_type, channel_id, account_id, email_address (for email channel),
|
||||
// webhook_url (for API channel), identifier (unique slug)
|
||||
type Inbox struct {
|
||||
Base
|
||||
AccountID uint `gorm:"index;not null" json:"account_id"`
|
||||
Name string `gorm:"size:255;not null" json:"name"`
|
||||
ChannelType string `gorm:"size:50;index;not null" json:"channel_type"` // web_widget, facebook, twitter, whatsapp, telegram, email, api, etc
|
||||
ChannelID uint `gorm:"index;not null" json:"channel_id"`
|
||||
EnableAutoAssignment bool `gorm:"default:false" json:"enable_auto_assignment"`
|
||||
AutoAssignmentLimit int `gorm:"default:0" json:"auto_assignment_limit"`
|
||||
Enabled bool `gorm:"default:true" json:"enabled"`
|
||||
ChannelConfig string `gorm:"type:text" json:"channel_config,omitempty"` // JSON-encoded per-inbox channel configuration
|
||||
|
||||
// Chatwoot inbox settings (from permitted_params)
|
||||
GreetingEnabled bool `gorm:"default:false" json:"greeting_enabled"`
|
||||
GreetingMessage string `gorm:"type:text" json:"greeting_message,omitempty"`
|
||||
EnableEmailCollect bool `gorm:"default:true" json:"enable_email_collect"`
|
||||
CsatSurveyEnabled bool `gorm:"default:false" json:"csat_survey_enabled"`
|
||||
WorkingHoursEnabled bool `gorm:"default:false" json:"working_hours_enabled"`
|
||||
OutOfOfficeMessage string `gorm:"type:text" json:"out_of_office_message,omitempty"`
|
||||
Timezone string `gorm:"size:100" json:"timezone,omitempty"` // e.g. "Asia/Kolkata"
|
||||
AllowMessagesAfterResolved bool `gorm:"default:true" json:"allow_messages_after_resolved"`
|
||||
LockToSingleConversation bool `gorm:"default:false" json:"lock_to_single_conversation"`
|
||||
SenderNameType string `gorm:"size:50;default:friendly" json:"sender_name_type,omitempty"` // friendly, professional
|
||||
BusinessName string `gorm:"size:255" json:"business_name,omitempty"`
|
||||
CsatConfig string `gorm:"type:text" json:"csat_config,omitempty"` // JSON-encoded CSAT survey configuration
|
||||
AvatarURL string `gorm:"size:1024" json:"avatar_url,omitempty"` // URL to inbox avatar image
|
||||
PortalID *uint `gorm:"index" json:"portal_id,omitempty"` // FK to help-center portal (nullable)
|
||||
|
||||
// API inbox specific fields
|
||||
WebhookURL string `gorm:"size:1024" json:"webhook_url,omitempty"` // webhook URL for API inboxes
|
||||
Secret string `gorm:"size:255" json:"secret,omitempty"` // HMAC secret for API inbox webhook verification
|
||||
|
||||
WorkingHours []WorkingHour `gorm:"foreignKey:InboxID" json:"working_hours,omitempty"`
|
||||
}
|
||||
|
||||
func (Inbox) TableName() string { return "inboxes" }
|
||||
Reference in New Issue
Block a user