From 34d61fcc7035ebd7ffb636d13308166c90b474b2 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 11 Aug 2024 22:15:36 +0900 Subject: feat: simplify starting procedure --- Makefile | 2 +- backend/admin/handler.go | 2 +- backend/admin/templates/game_edit.html | 4 +- backend/api/generated.go | 160 +++++-------------------- backend/fixtures/dev.sql | 14 +-- backend/game/hub.go | 120 +++++-------------- backend/game/message.go | 14 --- backend/game/models.go | 12 +- frontend/app/.server/api/schema.d.ts | 18 +-- frontend/app/components/GolfPlayApp.client.tsx | 7 +- openapi/api-server.yaml | 31 +---- 11 files changed, 85 insertions(+), 299 deletions(-) diff --git a/Makefile b/Makefile index 5cda0b3..9e776e9 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ DOCKER_COMPOSE := docker compose -f compose.local.yaml all: down build reset up reset: - echo "UPDATE games SET state = 'waiting_entries', started_at = NULL WHERE game_id = 7;" | make psql-query + echo "UPDATE games SET state = 'waiting', started_at = NULL WHERE game_id = 7;" | make psql-query .PHONY: build build: diff --git a/backend/admin/handler.go b/backend/admin/handler.go index d540f57..5398107 100644 --- a/backend/admin/handler.go +++ b/backend/admin/handler.go @@ -231,7 +231,7 @@ func (h *Handler) postGameEdit(c echo.Context) error { { // TODO: - if state != row.State && state == "prepare" { + if state != row.State && state == "starting" { err := h.hubs.StartGame(int(gameID)) if err != nil { return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) diff --git a/backend/admin/templates/game_edit.html b/backend/admin/templates/game_edit.html index c1e38a6..66f3b9e 100644 --- a/backend/admin/templates/game_edit.html +++ b/backend/admin/templates/game_edit.html @@ -25,9 +25,7 @@