mirror of
https://github.com/SamyRai/tercul-backend.git
synced 2025-12-27 00:31:35 +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
50 lines
1.8 KiB
Go
50 lines
1.8 KiB
Go
package models
|
|
|
|
// Edge represents a polymorphic relationship between entities
|
|
type Edge struct {
|
|
BaseModel
|
|
SourceTable string `gorm:"size:50;not null"`
|
|
SourceID uint `gorm:"not null"`
|
|
TargetTable string `gorm:"size:50;not null"`
|
|
TargetID uint `gorm:"not null"`
|
|
Relation string `gorm:"size:50;default:'ASSOCIATED_WITH';not null"`
|
|
Language string `gorm:"size:10;default:'en'"`
|
|
Extra JSONB `gorm:"type:jsonb;default:'{}'"`
|
|
}
|
|
|
|
// Embedding represents a vector embedding for an entity, used for keeping the copy of the embedding in the database,
|
|
// search is implemented in the weaviate package
|
|
type Embedding struct {
|
|
BaseModel
|
|
// External vector storage reference (e.g., Weaviate object UUID)
|
|
ExternalID string `gorm:"size:64;index"`
|
|
EntityType string `gorm:"size:50;not null"`
|
|
EntityID uint `gorm:"not null"`
|
|
Model string `gorm:"size:50;not null"` // e.g., bert, gpt, etc.
|
|
Dim int `gorm:"default:0"`
|
|
WorkID *uint
|
|
Work *Work `gorm:"foreignKey:WorkID"`
|
|
TranslationID *uint
|
|
Translation *Translation `gorm:"foreignKey:TranslationID"`
|
|
}
|
|
|
|
// Media represents a media file associated with an entity
|
|
type Media struct {
|
|
BaseModel
|
|
URL string `gorm:"size:512;not null"`
|
|
Type string `gorm:"size:50;not null"` // e.g., image, video, audio, etc.
|
|
MimeType string `gorm:"size:100"`
|
|
Size int64 `gorm:"default:0"`
|
|
Title string `gorm:"size:255"`
|
|
Description string `gorm:"type:text"`
|
|
Language string `gorm:"size:50;not null"`
|
|
AuthorID *uint
|
|
Author *Author `gorm:"foreignKey:AuthorID"`
|
|
TranslationID *uint
|
|
Translation *Translation `gorm:"foreignKey:TranslationID"`
|
|
CountryID *uint
|
|
Country *Country `gorm:"foreignKey:CountryID"`
|
|
CityID *uint
|
|
City *City `gorm:"foreignKey:CityID"`
|
|
}
|