tercul-backend/models/metadata.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

51 lines
1.3 KiB
Go

package models
import (
"time"
)
// LanguageAnalysis represents language analysis for a work
type LanguageAnalysis struct {
BaseModel
Language string `gorm:"size:50;not null"`
Analysis JSONB `gorm:"type:jsonb;default:'{}'"`
WorkID uint
Work *Work `gorm:"foreignKey:WorkID"`
}
// Gamification represents gamification elements for a user
type Gamification struct {
BaseModel
Points int `gorm:"default:0"`
Level int `gorm:"default:1"`
Badges JSONB `gorm:"type:jsonb;default:'{}'"`
Streaks int `gorm:"default:0"`
LastActive *time.Time
UserID uint
User *User `gorm:"foreignKey:UserID"`
}
// Stats represents general statistics
type Stats struct {
BaseModel
Data JSONB `gorm:"type:jsonb;default:'{}'"`
Period string `gorm:"size:50"` // e.g., daily, weekly, monthly, etc.
StartDate time.Time
EndDate time.Time
UserID *uint
User *User `gorm:"foreignKey:UserID"`
WorkID *uint
Work *Work `gorm:"foreignKey:WorkID"`
}
// SearchDocument is a denormalized text representation for indexing
type SearchDocument struct {
BaseModel
EntityType string `gorm:"size:50;index"`
EntityID uint `gorm:"index"`
LanguageCode string `gorm:"size:16;index"`
Title string `gorm:"size:512"`
Body string `gorm:"type:text"`
Keywords string `gorm:"type:text"`
}