aboutsummaryrefslogtreecommitdiffhomepage
path: root/backend/api/handler.go
diff options
context:
space:
mode:
Diffstat (limited to 'backend/api/handler.go')
-rw-r--r--backend/api/handler.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/backend/api/handler.go b/backend/api/handler.go
index 23c3cfe..8830d1c 100644
--- a/backend/api/handler.go
+++ b/backend/api/handler.go
@@ -135,6 +135,20 @@ func (h *Handler) GetGame(ctx context.Context, request GetGameRequestObject, use
}
}
}
+ playerRows, err := h.q.ListGamePlayers(ctx, int32(gameID))
+ if err != nil {
+ return nil, echo.NewHTTPError(http.StatusInternalServerError, err.Error())
+ }
+ players := make([]User, len(playerRows))
+ for i, playerRow := range playerRows {
+ players[i] = User{
+ UserID: int(playerRow.UserID),
+ Username: playerRow.Username,
+ DisplayName: playerRow.DisplayName,
+ IconPath: playerRow.IconPath,
+ IsAdmin: playerRow.IsAdmin,
+ }
+ }
game := Game{
GameID: int(row.GameID),
GameType: GameGameType(row.GameType),
@@ -143,6 +157,7 @@ func (h *Handler) GetGame(ctx context.Context, request GetGameRequestObject, use
DurationSeconds: int(row.DurationSeconds),
StartedAt: startedAt,
Problem: problem,
+ Players: players,
}
return GetGame200JSONResponse{
Game: game,