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

41 lines
1.2 KiB
Go

package models
// Tag represents a tag for categorizing works
type Tag struct {
BaseModel
Name string `gorm:"size:100;not null;uniqueIndex"`
Description string `gorm:"type:text"`
Works []*Work `gorm:"many2many:work_tags"`
Slug string `gorm:"size:255;index"`
}
// Category represents a category for organizing works
type Category struct {
BaseModel
Name string `gorm:"size:100;not null;uniqueIndex"`
Description string `gorm:"type:text"`
ParentID *uint
Parent *Category `gorm:"foreignKey:ParentID"`
Children []*Category `gorm:"foreignKey:ParentID"`
Works []*Work `gorm:"many2many:work_categories"`
Path string `gorm:"size:1024;index"`
Slug string `gorm:"size:255;index"`
}
// Series represents a literary series
type Series struct {
BaseModel
Name string `gorm:"size:255;not null;uniqueIndex"`
Description string `gorm:"type:text"`
}
// WorkSeries is a join capturing a work's position in a series
type WorkSeries struct {
BaseModel
WorkID uint
Work *Work `gorm:"foreignKey:WorkID"`
SeriesID uint
Series *Series `gorm:"foreignKey:SeriesID"`
NumberInSeries int `gorm:"default:0"`
}