feat: order processing
feat: order commands result save/load
This commit is contained in:
@@ -2,17 +2,40 @@ package router_test
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/google/uuid"
|
||||
"github.com/iliadenisov/galaxy/internal/model/order"
|
||||
"github.com/iliadenisov/galaxy/internal/model/rest"
|
||||
"github.com/iliadenisov/galaxy/internal/router"
|
||||
"github.com/iliadenisov/galaxy/internal/router/handler"
|
||||
)
|
||||
|
||||
var (
|
||||
commandNoErrorsStatus = http.StatusNoContent
|
||||
commandDefaultActor = "Gorlum"
|
||||
apiCommandMethod = "PUT"
|
||||
apiCommandPath = "/api/v1/command"
|
||||
apiOrderPath = "/api/v1/order"
|
||||
validId1 = id()
|
||||
validId2 = id()
|
||||
invalidId = "fd091c69-5976-4775-b2f9-7ba77735afb"
|
||||
)
|
||||
|
||||
func id() string {
|
||||
return uuid.New().String()
|
||||
}
|
||||
|
||||
type dummyExecutor struct {
|
||||
CommandsExecuted int
|
||||
}
|
||||
|
||||
func (e *dummyExecutor) ValidateOrder(actor string, cmd ...order.DecodableCommand) error {
|
||||
e.CommandsExecuted = len(cmd)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (e *dummyExecutor) Execute(command ...handler.Command) error {
|
||||
e.CommandsExecuted = len(command)
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user