package doctextprocessrunner import ( "context" "log/slog" documenttext "queryorchestration/internal/document/text" "github.com/go-playground/validator/v10" ) const Name = "docTextProcessRunner" type Services struct { Text *documenttext.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 { Bucket string `json:"bucket" validate:"required"` Key string `json:"key" validate:"required"` Hash string `json:"hash" validate:"required"` ClientID string `json:"clientId" validate:"required"` } func (s Runner) Process(ctx context.Context, body Body) bool { err := s.svc.Text.Process(ctx, &documenttext.ProcessParams{ Bucket: body.Bucket, Key: body.Key, Hash: body.Hash, ClientID: body.ClientID, }) if err != nil { slog.Error("unable to process", "bucket", body.Bucket, "key", body.Key, "hash", body.Hash, "error", err) return false } return true }