Merged in feature/document (pull request #36)

Document CRUD

* doccreate

* dochashlocandget

* depsandtodo
This commit is contained in:
Michael McGuinness
2025-01-24 16:12:25 +00:00
parent 4ec1d51a12
commit b16ff55afa
31 changed files with 381 additions and 82 deletions
+12 -8
View File
@@ -3,7 +3,7 @@ package controllers
import (
"context"
"encoding/json"
"queryorchestration/internal/query/document"
documentsync "queryorchestration/internal/document/sync"
"github.com/go-playground/validator/v10"
@@ -11,15 +11,19 @@ import (
"github.com/google/uuid"
)
type QueryRunner struct {
validator *validator.Validate
document *document.Service
type Services struct {
DocumentSync *documentsync.Service
}
func NewQueryRunner(svc *document.Service, validator *validator.Validate) QueryRunner {
type QueryRunner struct {
validator *validator.Validate
svc *Services
}
func NewQueryRunner(validator *validator.Validate, svc *Services) QueryRunner {
return QueryRunner{
validator: validator,
document: svc,
svc: svc,
}
}
@@ -28,7 +32,7 @@ type DocumentQueryEvent struct {
}
func (s QueryRunner) Process(ctx context.Context, req *types.Message) error {
var body document.Document
var body documentsync.Document
err := json.Unmarshal([]byte(*req.Body), &body)
if err != nil {
return err
@@ -39,7 +43,7 @@ func (s QueryRunner) Process(ctx context.Context, req *types.Message) error {
return err
}
err = s.document.Sync(ctx, &body)
err = s.svc.DocumentSync.Sync(ctx, &body)
if err != nil {
return err
}