diff options
| author | tyropro <[email protected]> | 2026-05-11 13:55:20 +0100 |
|---|---|---|
| committer | tyropro <[email protected]> | 2026-05-11 13:56:22 +0100 |
| commit | 0bc26c4974367549476ce28805fa727e3756f230 (patch) | |
| tree | 5d1c676829b09a037cb8ebf636104a641ecd98e9 | |
| parent | 5a4e848bd00b4ad5796921d7907f179b3b5590cf (diff) | |
fix: added lobbyname to lobby properties and fixed the ShouldBindJSON call
| -rw-r--r-- | internal/api/lobbies.go | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/internal/api/lobbies.go b/internal/api/lobbies.go index 70435aa..2a4ec93 100644 --- a/internal/api/lobbies.go +++ b/internal/api/lobbies.go @@ -25,6 +25,7 @@ type LobbyManager struct { type Lobby struct { UUID string `json:"uuid"` + Name string `json:"name"` Players map[string]Player `json:"players"` PlayerOrder map[string]*string `json:"player_order"` @@ -55,9 +56,10 @@ func NewLobbyManager() *LobbyManager { } } -func NewLobby(lobby_uuid string, host_uuid string, pin *string, request_on_join_enabled bool) Lobby { +func NewLobby(lobby_uuid string, lobby_name string, host_uuid string, pin *string, request_on_join_enabled bool) Lobby { return Lobby{ UUID: lobby_uuid, + Name: lobby_name, Players: make(map[string]Player), PlayerOrder: make(map[string]*string), @@ -220,7 +222,7 @@ func get_lobby(lobby_manager *LobbyManager) gin.HandlerFunc { type CreateLobbyRequest struct { HostPlayerName string `json:"host_player_name"` - LobbyPlayerName string `json:"lobby_player_name"` + LobbyName string `json:"lobby_name"` PINEnabled bool `json:"pin_enabled"` RequestOnJoinEnabled bool `json:"request_on_join_enabled"` } @@ -236,7 +238,7 @@ func create_lobby(lobby_manager *LobbyManager) gin.HandlerFunc { var req_body CreateLobbyRequest - err := c.ShouldBindJSON(req_body) + err := c.ShouldBindJSON(&req_body) if err != nil { c.IndentedJSON(status.GenerateErrorResponse(status.BodyMarshallError)) return @@ -251,7 +253,7 @@ func create_lobby(lobby_manager *LobbyManager) gin.HandlerFunc { pin = generatePIN() } - new_lobby := NewLobby(lobby_uuid, host_player_uuid, pin, req_body.RequestOnJoinEnabled) + new_lobby := NewLobby(lobby_uuid, req_body.LobbyName, host_player_uuid, pin, req_body.RequestOnJoinEnabled) lobby_manager.Lobbies[lobby_uuid] = new_lobby |
