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,31 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"gorm.io/datatypes"
|
||||
)
|
||||
|
||||
// Message represents a message within a conversation.
|
||||
type Message struct {
|
||||
Base
|
||||
ConversationID uint `gorm:"index;not null" json:"conversation_id"`
|
||||
AccountID uint `gorm:"index;not null" json:"account_id"`
|
||||
InboxID uint `gorm:"index;not null" json:"inbox_id"`
|
||||
SenderID *uint `gorm:"index" json:"sender_id,omitempty"`
|
||||
SenderType string `gorm:"size:50" json:"sender_type"` // contact, agent, bot
|
||||
Content string `gorm:"type:text" json:"content"`
|
||||
ContentType string `gorm:"size:50;default:text" json:"content_type"` // text, input, input_csat, file, image, etc
|
||||
Status string `gorm:"size:50;default:sent" json:"status"` // sent, delivered, read, failed
|
||||
Private bool `gorm:"default:false" json:"private"`
|
||||
EchoID string `gorm:"size:255" json:"echo_id,omitempty"`
|
||||
SourceID string `gorm:"size:255" json:"source_id,omitempty"`
|
||||
MessageType string `gorm:"size:50;default:incoming" json:"message_type"` // incoming, outgoing, activity, template
|
||||
External bool `gorm:"default:false" json:"external"`
|
||||
ContentAttributes datatypes.JSON `gorm:"type:jsonb" json:"content_attributes,omitempty"` // attachments, mentions, etc
|
||||
AdditionalAttributes datatypes.JSON `gorm:"type:jsonb" json:"additional_attributes,omitempty"`
|
||||
ExternalSourceIDs datatypes.JSON `gorm:"type:jsonb" json:"external_source_ids,omitempty"` // external platform IDs
|
||||
|
||||
Conversation *Conversation `gorm:"foreignKey:ConversationID" json:"conversation,omitempty"`
|
||||
Attachments []Attachment `gorm:"foreignKey:MessageID" json:"attachments,omitempty"`
|
||||
}
|
||||
|
||||
func (Message) TableName() string { return "messages" }
|
||||
Reference in New Issue
Block a user