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

95 lines
3.1 KiB
Go

package models
import (
"time"
)
// Notification represents a notification for a user
type Notification struct {
BaseModel
Message string `gorm:"type:text;not null"`
Type string `gorm:"size:50"` // e.g., comment, like, follow, etc.
Read bool `gorm:"default:false"`
Language string `gorm:"size:50;not null"`
UserID uint
User *User `gorm:"foreignKey:UserID"`
RelatedID *uint // ID of the related entity (work, comment, etc.)
RelatedType string `gorm:"size:50"` // Type of the related entity
}
// EditorialWorkflow represents an editorial workflow for a work or translation
type EditorialWorkflow struct {
BaseModel
Stage string `gorm:"size:50;not null"` // e.g., draft, review, editing, published
Notes string `gorm:"type:text"`
Language string `gorm:"size:50;not null"`
WorkID *uint
Work *Work `gorm:"foreignKey:WorkID"`
TranslationID *uint
Translation *Translation `gorm:"foreignKey:TranslationID"`
UserID uint
User *User `gorm:"foreignKey:UserID"`
AssignedToID *uint
AssignedTo *User `gorm:"foreignKey:AssignedToID"`
DueDate *time.Time
CompletedAt *time.Time
}
// Admin represents an admin user
type Admin struct {
BaseModel
UserID uint
User *User `gorm:"foreignKey:UserID"`
Role string `gorm:"size:50;not null"` // e.g., super, content, user, etc.
Permissions JSONB `gorm:"type:jsonb;default:'{}'"`
}
// Vote represents a vote on a work, translation, or comment
type Vote struct {
BaseModel
Value int `gorm:"default:0"` // Positive or negative value
UserID uint
User *User `gorm:"foreignKey:UserID"`
WorkID *uint
Work *Work `gorm:"foreignKey:WorkID"`
TranslationID *uint
Translation *Translation `gorm:"foreignKey:TranslationID"`
CommentID *uint
Comment *Comment `gorm:"foreignKey:CommentID"`
}
// Contributor represents a contributor to a work or translation
type Contributor struct {
BaseModel
Name string `gorm:"size:100;not null"`
Role string `gorm:"size:50"` // e.g., author, translator, editor, etc.
UserID *uint
User *User `gorm:"foreignKey:UserID"`
WorkID *uint
Work *Work `gorm:"foreignKey:WorkID"`
TranslationID *uint
Translation *Translation `gorm:"foreignKey:TranslationID"`
}
// InteractionEvent captures raw interaction signals for later aggregation
type InteractionEvent struct {
BaseModel
UserID *uint
User *User `gorm:"foreignKey:UserID"`
TargetType string `gorm:"size:50;not null"` // work|translation|comment|collection|media
TargetID uint `gorm:"not null"`
Kind string `gorm:"size:30;not null"` // view|like|comment|share|bookmark
OccurredAt time.Time `gorm:"index"`
}
// HybridEntityWork represents a hybrid entity for a work
type HybridEntityWork struct {
BaseModel
Name string `gorm:"size:100;not null"`
Type string `gorm:"size:50"` // e.g., work, translation, etc.
WorkID *uint
Work *Work `gorm:"foreignKey:WorkID"`
TranslationID *uint
Translation *Translation `gorm:"foreignKey:TranslationID"`
}