DEVELOPMENT ENVIRONMENT

~liljamo/deck-builder

cc99931ccdecdbc1dff5dc3850fd03b1f5a056b1 — skye 1 year, 7 months ago 3575d63
feat(api): update gamestate when joining
1 files changed, 2 insertions(+), 2 deletions(-)

M api/handlers/joingame.go
M api/handlers/joingame.go => api/handlers/joingame.go +2 -2
@@ 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()