Merged in feature/richname (pull request #112)

Standardised rich name for Files

* tests
This commit is contained in:
Michael McGuinness
2025-04-03 19:17:24 +00:00
parent 1d49313a9f
commit 60812aba91
31 changed files with 744 additions and 601 deletions
+13 -11
View File
@@ -4,8 +4,8 @@ import (
"context"
"log/slog"
"queryorchestration/internal/document"
documentinit "queryorchestration/internal/document/init"
"queryorchestration/internal/serviceconfig/objectstore"
"github.com/go-playground/validator/v10"
)
@@ -29,20 +29,22 @@ func New(validator *validator.Validate, svc *Services) Runner {
}
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"`
Bucket string `json:"bucket" validate:"required"`
Key string `json:"key" validate:"required"`
Hash string `json:"hash" validate:"required"`
}
func (s Runner) Process(ctx context.Context, body Body) bool {
key, err := objectstore.ParseBucketKey(body.Key)
if err != nil {
slog.Error("unable to parse key", "key", body.Key)
return false
}
id, err := s.svc.Document.Create(ctx, &documentinit.Create{
ClientID: body.ClientID,
Location: document.Location{
Bucket: body.Bucket,
Key: body.Key,
},
Hash: body.Hash,
Key: key,
Bucket: body.Bucket,
Hash: body.Hash,
})
if err != nil {
return false