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

65 lines
1.8 KiB
Go

package models
// Country represents a country
type Country struct {
TranslatableModel
Name string `gorm:"size:100;not null"`
Code string `gorm:"size:2;not null;uniqueIndex"`
PhoneCode string `gorm:"size:10"`
Currency string `gorm:"size:3"`
Continent string `gorm:"size:20"`
// Relationships
Cities []*City `gorm:"foreignKey:CountryID"`
Places []*Place `gorm:"foreignKey:CountryID"`
Addresses []*Address `gorm:"foreignKey:CountryID"`
}
// Language represents a normalized language reference (ISO-639)
type Language struct {
BaseModel
Code string `gorm:"size:16;not null;uniqueIndex"` // e.g., en, en-US, eng
Name string `gorm:"size:100;not null"`
Script string `gorm:"size:20"` // Latn, Cyrl
Direction string `gorm:"size:5"` // ltr, rtl
}
// City represents a city
type City struct {
TranslatableModel
Name string `gorm:"size:100;not null"`
CountryID uint
Country *Country `gorm:"foreignKey:CountryID"`
// Relationships
Places []*Place `gorm:"foreignKey:CityID"`
Addresses []*Address `gorm:"foreignKey:CityID"`
}
// Place represents a specific place (landmark, building, etc.)
type Place struct {
TranslatableModel
Name string `gorm:"size:100;not null"`
Description string `gorm:"type:text"`
Latitude float64
Longitude float64
CountryID *uint
Country *Country `gorm:"foreignKey:CountryID"`
CityID *uint
City *City `gorm:"foreignKey:CityID"`
}
// Address represents a physical address
type Address struct {
BaseModel
Street string `gorm:"size:255"`
StreetNumber string `gorm:"size:20"`
PostalCode string `gorm:"size:20"`
CountryID *uint
Country *Country `gorm:"foreignKey:CountryID"`
CityID *uint
City *City `gorm:"foreignKey:CityID"`
Latitude *float64
Longitude *float64
}