package models import () // Comment представляет комментарий к отзыву (Feedback) type Comment struct { /*ID, CreatedAt, UpdatedAt, DeletedAt (Update's history)*/ Base `gorm:"embedded"` // Автор комментария AuthorID uint `gorm:"not null;index" json:"author_id"` Author Account `gorm:"foreignKey:AuthorID;references:ID" json:"author,omitempty"` // Отзыв, к которому оставлен комментарий FeedbackID uint `gorm:"not null;index" json:"feedback_id"` Feedback Feedback `gorm:"foreignKey:FeedbackID;references:ID" json:"feedback,omitempty"` // Содержание комментария Text string `gorm:"not null" json:"text"` // Для поддержки вложенных комментариев (ответы на комментарии) ParentID *uint `gorm:"index" json:"parent_id,omitempty"` // NULL для корневых комментариев Parent *Comment `gorm:"foreignKey:ParentID;references:ID" json:"parent,omitempty"` Replies []Comment `gorm:"foreignKey:ParentID;references:ID" json:"replies,omitempty"` // Статус IsEdited bool `gorm:"default:false" json:"is_edited"` IsVerified bool `gorm:"default:false" json:"is_verified"` // если нужна модерация }