Merged in feature/richname (pull request #112)
Standardised rich name for Files * tests
This commit is contained in:
+13
-11
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user