package models // WorkStats represents statistics for a work type WorkStats struct { BaseModel Views int64 `gorm:"default:0"` Likes int64 `gorm:"default:0"` Comments int64 `gorm:"default:0"` Bookmarks int64 `gorm:"default:0"` Shares int64 `gorm:"default:0"` WorkID uint Work *Work `gorm:"foreignKey:WorkID"` } // TranslationStats represents statistics for a translation type TranslationStats struct { BaseModel Views int64 `gorm:"default:0"` Likes int64 `gorm:"default:0"` Comments int64 `gorm:"default:0"` Shares int64 `gorm:"default:0"` TranslationID uint Translation *Translation `gorm:"foreignKey:TranslationID"` } // UserStats represents statistics for a user type UserStats struct { BaseModel Activity int64 `gorm:"default:0"` // General activity score Works int64 `gorm:"default:0"` // Number of works created Translations int64 `gorm:"default:0"` // Number of translations created Comments int64 `gorm:"default:0"` // Number of comments posted Likes int64 `gorm:"default:0"` // Number of likes given Bookmarks int64 `gorm:"default:0"` // Number of bookmarks created UserID uint User *User `gorm:"foreignKey:UserID"` } // BookStats represents statistics for a book type BookStats struct { BaseModel Sales int64 `gorm:"default:0"` Views int64 `gorm:"default:0"` Likes int64 `gorm:"default:0"` BookID uint Book *Book `gorm:"foreignKey:BookID"` } // CollectionStats represents statistics for a collection type CollectionStats struct { BaseModel Items int64 `gorm:"default:0"` // Number of works in the collection Views int64 `gorm:"default:0"` Likes int64 `gorm:"default:0"` CollectionID uint Collection *Collection `gorm:"foreignKey:CollectionID"` } // MediaStats represents statistics for media type MediaStats struct { BaseModel Views int64 `gorm:"default:0"` Downloads int64 `gorm:"default:0"` Shares int64 `gorm:"default:0"` MediaID uint Media interface{} `gorm:"-"` // This would be a pointer to a Media type if it existed }