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"` }