Files
query-orchestration/api/docCleanRunner/runner.go
T

44 lines
771 B
Go
Raw Normal View History

package doccleanrunner
import (
"context"
"log/slog"
2025-03-05 12:05:46 +00:00
documentclean "queryorchestration/internal/document/clean"
"github.com/go-playground/validator/v10"
"github.com/google/uuid"
)
const Name = "docCleanRunner"
type Services struct {
Clean *documentclean.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 {
DocumentID uuid.UUID `json:"id" validate:"required,uuid"`
}
func (s Runner) Process(ctx context.Context, body Body) bool {
err := s.svc.Clean.Clean(ctx, body.DocumentID)
if err != nil {
slog.Error("unable to process", "error", err)
return false
}
return true
}