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"` }