Skip to content

Commit

Permalink
Make /games return an object
Browse files Browse the repository at this point in the history
  • Loading branch information
konsumlamm committed Feb 10, 2024
1 parent 9606279 commit fa6f552
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ns2-stat-api/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ async fn get_continuous_stats(data: Data<AppData>, query: Query<DateQuery>) -> J
}

#[get("/games")]
async fn get_games(data: Data<AppData>, query: Query<DateQuery>) -> Json<Vec<GameSummary>> {
async fn get_games(data: Data<AppData>, query: Query<DateQuery>) -> Json<BTreeMap<u32, GameSummary>> {
let games = data.games.read();
Json(games.range(query.to_range_bounds()).map(|(_, game)| summarize_game(game)).collect())
Json(games.range(query.to_range_bounds()).map(|(&date, game)| (date, summarize_game(game))).collect())
}

#[get("/games/latest")]
Expand Down

0 comments on commit fa6f552

Please sign in to comment.