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
43 lines
1.2 KiB
Go
43 lines
1.2 KiB
Go
package models
|
|
|
|
// BookWork represents the many-to-many relationship between books and works
|
|
type BookWork struct {
|
|
BaseModel
|
|
BookID uint
|
|
Book *Book `gorm:"foreignKey:BookID"`
|
|
WorkID uint
|
|
Work *Work `gorm:"foreignKey:WorkID"`
|
|
Order int `gorm:"default:0"` // For ordering works in books
|
|
}
|
|
|
|
// AuthorCountry represents the many-to-many relationship between authors and countries
|
|
type AuthorCountry struct {
|
|
BaseModel
|
|
AuthorID uint
|
|
Author *Author `gorm:"foreignKey:AuthorID"`
|
|
CountryID uint
|
|
Country *Country `gorm:"foreignKey:CountryID"`
|
|
}
|
|
|
|
// WorkAuthor represents authorship with role and order for a work
|
|
type WorkAuthor struct {
|
|
BaseModel
|
|
WorkID uint
|
|
Work *Work `gorm:"foreignKey:WorkID"`
|
|
AuthorID uint
|
|
Author *Author `gorm:"foreignKey:AuthorID"`
|
|
Role string `gorm:"size:50;default:'author'"`
|
|
Ordinal int `gorm:"default:0"`
|
|
}
|
|
|
|
// BookAuthor represents book-level contributor role and order
|
|
type BookAuthor struct {
|
|
BaseModel
|
|
BookID uint
|
|
Book *Book `gorm:"foreignKey:BookID"`
|
|
AuthorID uint
|
|
Author *Author `gorm:"foreignKey:AuthorID"`
|
|
Role string `gorm:"size:50;default:'author'"`
|
|
Ordinal int `gorm:"default:0"`
|
|
}
|