Skip to content

Commit

Permalink
Add more stats to the stats API
Browse files Browse the repository at this point in the history
  • Loading branch information
JustAman62 committed Sep 1, 2024
1 parent 86e3633 commit f96b571
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions server/GridBattle.Api/Api/StatsApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace GridBattle.Api;

public sealed record StatsDto(string Version, int GridCount, int TimerBattleCount);
public sealed record StatsDto(string Version, int GridCount, int TimerBattleCount, int UserCount);

public static class StatsApi
{
Expand All @@ -19,6 +19,7 @@ private static async Task<IResult> GetStats([FromServices] GridDbContext dbConte
var version = ThisAssembly.AssemblyInformationalVersion;
var gridCount = await dbContext.Grids.CountAsync();
var timerBattleCount = await dbContext.TimerBattleRooms.CountAsync();
return TypedResults.Ok(new StatsDto(version, gridCount, timerBattleCount));
var userCount = await dbContext.Users.CountAsync();
return TypedResults.Ok(new StatsDto(version, gridCount, timerBattleCount, userCount));
}
}

0 comments on commit f96b571

Please sign in to comment.