refactor: executors and routers

* refactor: executors and routers
This commit is contained in:
Ilia Denisov
2026-02-09 15:53:34 +03:00
committed by GitHub
parent e48a0c8b96
commit d9c8de27e5
38 changed files with 508 additions and 838 deletions
+4 -10
View File
@@ -4,20 +4,14 @@ import (
"net/http"
"github.com/gin-gonic/gin"
"github.com/iliadenisov/galaxy/internal/controller"
"github.com/iliadenisov/galaxy/internal/game"
"github.com/iliadenisov/galaxy/internal/model/rest"
)
func StatusHandler(c *gin.Context, config controller.Configurer) {
g, err := game.LoadState(config)
func StatusHandler(c *gin.Context, executor CommandExecutor) {
state, err := executor.GameState()
if transformError(c, err) {
if errorResponded(c, err) {
return
}
c.JSON(http.StatusOK, rest.Status{
Turn: g.Turn,
Players: len(g.Race),
})
c.JSON(http.StatusOK, state)
}