From cc99931ccdecdbc1dff5dc3850fd03b1f5a056b1 Mon Sep 17 00:00:00 2001 From: skye Date: Fri, 28 Apr 2023 10:43:47 +0300 Subject: [PATCH] feat(api): update gamestate when joining --- api/handlers/joingame.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/handlers/joingame.go b/api/handlers/joingame.go index 4b799bf..93436ad 100644 --- a/api/handlers/joingame.go +++ b/api/handlers/joingame.go @@ -58,8 +58,8 @@ func JoinGame(c *gin.Context) { return } - // if we are not the host, set us as the guest - updatedGame := db.DbConn.Model(&game).Update("guest_id", newGuest.ID) + // if we are not the host, set us as the guest, and "start" the game + updatedGame := db.DbConn.Model(&game).Updates(models.Game{GuestID: newGuest.ID, State: models.GAMESTATE_INPROGRESS}) if updatedGame.Error != nil { c.JSON(http.StatusInternalServerError, gin.H{"error": apierror.Placeholder}) c.Abort() -- 2.44.1