extract common create and updatelogic
This commit is contained in:
@@ -4,8 +4,6 @@ import (
|
||||
"context"
|
||||
"queryorchestration/internal/database/repository"
|
||||
queryprocessor "queryorchestration/internal/queryProcessor"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
type Creator struct {
|
||||
@@ -18,15 +16,6 @@ func NewCreator(db *repository.Queries) Creator {
|
||||
|
||||
func (s Creator) Validate(ctx context.Context, entity *queryprocessor.Create) error {
|
||||
// TODO
|
||||
// Type, RequiredQueryIDs, Config
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s Creator) Create(ctx context.Context, entity *queryprocessor.Create) (uuid.UUID, error) {
|
||||
err := s.Validate(ctx, entity)
|
||||
if err != nil {
|
||||
return uuid.Nil, err
|
||||
}
|
||||
|
||||
// TODO
|
||||
return uuid.Nil, nil
|
||||
}
|
||||
|
||||
@@ -14,17 +14,8 @@ func NewUpdator(db *repository.Queries) Updator {
|
||||
return Updator{db}
|
||||
}
|
||||
|
||||
func (s Updator) Validate(ctx context.Context, entity *queryprocessor.Update) error {
|
||||
// TODO
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s Updator) Update(ctx context.Context, entity *queryprocessor.Update) error {
|
||||
err := s.Validate(ctx, entity)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
func (s Updator) Validate(ctx context.Context, current *queryprocessor.Query, entity *queryprocessor.Update) error {
|
||||
// TODO
|
||||
// Type, RequiredQueryIDs, Config
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user