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 }