Merged in feature/document (pull request #36)
Document CRUD * doccreate * dochashlocandget * depsandtodo
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user