mirror of
https://github.com/SamyRai/tercul-backend.git
synced 2025-12-27 05:11:34 +00:00
- 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
68 lines
2.1 KiB
Go
68 lines
2.1 KiB
Go
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
|
|
}
|