From f96b571d7d6f1fd1eefa32844472b2d3e6ed8570 Mon Sep 17 00:00:00 2001 From: BrownKnight Date: Sun, 1 Sep 2024 12:02:55 +0100 Subject: [PATCH] Add more stats to the stats API --- server/GridBattle.Api/Api/StatsApi.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server/GridBattle.Api/Api/StatsApi.cs b/server/GridBattle.Api/Api/StatsApi.cs index 5db2190..598ec80 100644 --- a/server/GridBattle.Api/Api/StatsApi.cs +++ b/server/GridBattle.Api/Api/StatsApi.cs @@ -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 { @@ -19,6 +19,7 @@ private static async Task 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)); } }