tercul-backend/models/interaction.go
Damir Mukimov 4957117cb6 Initial commit: Tercul Go project with comprehensive architecture
- Core Go application with GraphQL API using gqlgen
- Comprehensive data models for literary works, authors, translations
- Repository pattern with caching layer
- Authentication and authorization system
- Linguistics analysis capabilities with multiple adapters
- Vector search integration with Weaviate
- Docker containerization support
- Python data migration and analysis scripts
- Clean architecture with proper separation of concerns
- Production-ready configuration and middleware
- Proper .gitignore excluding vendor/, database files, and build artifacts
2025-08-13 07:42:32 +02:00

80 lines
2.5 KiB
Go

package models
import (
"time"
)
// Comment represents a user comment on a work or translation
type Comment struct {
BaseModel
Text string `gorm:"type:text;not null"`
UserID uint
User *User `gorm:"foreignKey:UserID"`
WorkID *uint
Work *Work `gorm:"foreignKey:WorkID"`
TranslationID *uint
Translation *Translation `gorm:"foreignKey:TranslationID"`
LineNumber *int `gorm:"index"`
TextBlockID *uint
TextBlock *TextBlock `gorm:"foreignKey:TextBlockID"`
ParentID *uint
Parent *Comment `gorm:"foreignKey:ParentID"`
Children []*Comment `gorm:"foreignKey:ParentID"`
Likes []*Like `gorm:"foreignKey:CommentID"`
}
// Like represents a user like on a work, translation, or comment
type Like struct {
BaseModel
UserID uint
User *User `gorm:"foreignKey:UserID"`
WorkID *uint
Work *Work `gorm:"foreignKey:WorkID"`
TranslationID *uint
Translation *Translation `gorm:"foreignKey:TranslationID"`
CommentID *uint
Comment *Comment `gorm:"foreignKey:CommentID"`
}
// Bookmark represents a user bookmark of a work
type Bookmark struct {
BaseModel
Name string `gorm:"size:100"`
UserID uint
User *User `gorm:"foreignKey:UserID"`
WorkID uint
Work *Work `gorm:"foreignKey:WorkID"`
Notes string `gorm:"type:text"`
LastReadAt *time.Time
Progress int `gorm:"default:0"` // Percentage of completion
}
// Collection represents a user-created collection of works
type Collection struct {
TranslatableModel
Name string `gorm:"size:100;not null"`
Description string `gorm:"type:text"`
UserID uint
User *User `gorm:"foreignKey:UserID"`
Works []*Work `gorm:"many2many:collection_works"`
IsPublic bool `gorm:"default:true"`
CoverImageURL string `gorm:"size:255"`
}
// Contribution represents a user contribution (work or translation)
type Contribution struct {
BaseModel
Name string `gorm:"size:100;not null"`
Status string `gorm:"size:20;default:'draft'"` // draft, submitted, reviewing, approved, rejected
UserID uint
User *User `gorm:"foreignKey:UserID"`
WorkID *uint
Work *Work `gorm:"foreignKey:WorkID"`
TranslationID *uint
Translation *Translation `gorm:"foreignKey:TranslationID"`
ReviewerID *uint
Reviewer *User `gorm:"foreignKey:ReviewerID"`
ReviewedAt *time.Time
Feedback string `gorm:"type:text"`
}