81e7223560
Text Extraction * bases * go * splitting * structure * movetoasync * movetoasync * settinguptrigger * reorder * storevent * standardisepollingvalidation * unittests * fixlint * fixlint * awscfg * generatesample * followthrough * tests * clena * store * externalidcleanup * clientid * local * baseunittests * putobjecttests * tests
43 lines
738 B
Go
43 lines
738 B
Go
package clientsyncrunner
|
|
|
|
import (
|
|
"context"
|
|
"log/slog"
|
|
|
|
clientsync "queryorchestration/internal/client/sync"
|
|
|
|
"github.com/go-playground/validator/v10"
|
|
)
|
|
|
|
const Name = "clientSyncRunner"
|
|
|
|
type Services struct {
|
|
ClientSync *clientsync.Service
|
|
}
|
|
|
|
type Runner struct {
|
|
validator *validator.Validate
|
|
svc *Services
|
|
}
|
|
|
|
func New(validator *validator.Validate, svc *Services) Runner {
|
|
return Runner{
|
|
validator: validator,
|
|
svc: svc,
|
|
}
|
|
}
|
|
|
|
type Body struct {
|
|
ClientID string `json:"id" validate:"required"`
|
|
}
|
|
|
|
func (s *Runner) Process(ctx context.Context, body Body) bool {
|
|
err := s.svc.ClientSync.Sync(ctx, body.ClientID)
|
|
if err != nil {
|
|
slog.Error("unable to process", "error", err)
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|