refactor: rename game package to connect4, drop Game prefix from types
Rename game/ -> connect4/ to avoid c4/game stutter. Drop redundant
Game prefix from exported types (GameStore -> Store, GameInstance ->
Instance, GameStatus -> Status). Rename NATS subjects from game.{id}
to connect4.{id}. URL routes unchanged.
This commit is contained in:
@@ -7,10 +7,10 @@ import (
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/ryanhamamura/c4/connect4"
|
||||
"github.com/ryanhamamura/c4/db/repository"
|
||||
lobbycomponents "github.com/ryanhamamura/c4/features/lobby/components"
|
||||
"github.com/ryanhamamura/c4/features/lobby/pages"
|
||||
"github.com/ryanhamamura/c4/game"
|
||||
"github.com/ryanhamamura/c4/snake"
|
||||
|
||||
"github.com/alexedwards/scs/v2"
|
||||
@@ -80,7 +80,7 @@ func HandleLobbyPage(queries *repository.Queries, sessions *scs.SessionManager,
|
||||
}
|
||||
|
||||
// HandleCreateGame reads the nickname signal, creates a connect4 game, and redirects via SSE.
|
||||
func HandleCreateGame(store *game.GameStore, sessions *scs.SessionManager) http.HandlerFunc {
|
||||
func HandleCreateGame(store *connect4.Store, sessions *scs.SessionManager) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
type Signals struct {
|
||||
Nickname string `json:"nickname"`
|
||||
@@ -104,7 +104,7 @@ func HandleCreateGame(store *game.GameStore, sessions *scs.SessionManager) http.
|
||||
}
|
||||
|
||||
// HandleDeleteGame deletes a connect4 game and redirects to the lobby.
|
||||
func HandleDeleteGame(store *game.GameStore, sessions *scs.SessionManager) http.HandlerFunc {
|
||||
func HandleDeleteGame(store *connect4.Store, sessions *scs.SessionManager) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
gameID := chi.URLParam(r, "id")
|
||||
if gameID == "" {
|
||||
|
||||
Reference in New Issue
Block a user