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

40 lines
739 B
Go

package syncjob
import (
"context"
"log"
"github.com/hibiken/asynq"
"gorm.io/gorm"
)
// SyncJob manages the sync process.
type SyncJob struct {
DB *gorm.DB
AsynqClient *asynq.Client
}
// NewSyncJob initializes a new SyncJob.
func NewSyncJob(db *gorm.DB, aClient *asynq.Client) *SyncJob {
return &SyncJob{
DB: db,
AsynqClient: aClient,
}
}
// RunFullSync performs a full sync of all entities and edges.
func (s *SyncJob) RunFullSync(ctx context.Context) error {
log.Println("Starting full database sync...")
if err := s.SyncAllEntities(ctx); err != nil {
return err
}
if err := s.SyncAllEdges(ctx); err != nil {
return err
}
log.Println("Database sync completed successfully.")
return nil
}