diff --git a/API/Controllers/TimeTrackController.cs b/API/Controllers/TimeTrackController.cs index 2677a45..3d04f7a 100644 --- a/API/Controllers/TimeTrackController.cs +++ b/API/Controllers/TimeTrackController.cs @@ -10,16 +10,17 @@ public class TimeTrackController(Context databaseContext) : ApiController(typeof { [HttpGet("{steamId}")] - [ProducesResponseType>(Status200OK)] + [ProducesResponseType[]>(Status200OK)] [ProducesResponseType(Status404NotFound)] public IActionResult GetTrackedTime(ulong steamId) { if (databaseContext.Players.Find(steamId) is not { } player) return NotFound(); databaseContext.Entry(player).Collection(p => p.TrackedTimes).Load(); - Dictionary ret = player.TrackedTimes + KeyValuePair[] ret = player.TrackedTimes .GroupBy(t => t.Game) - .ToDictionary(t => t.Key.AppId, t => t.ToArray()); + .Select(t => new KeyValuePair(t.Key.AppId, t.ToArray())) + .ToArray(); return Ok(ret); } @@ -54,16 +55,17 @@ public class TimeTrackController(Context databaseContext) : ApiController(typeof } [HttpGet("{steamId}/Total/PerGame")] - [ProducesResponseType>(Status200OK)] + [ProducesResponseType[]>(Status200OK)] [ProducesResponseType(Status404NotFound)] public IActionResult GetTrackedTimeAll(ulong steamId) { if (databaseContext.Players.Find(steamId) is not { } player) return NotFound(); databaseContext.Entry(player).Collection(p => p.TrackedTimes).Load(); - Dictionary trackedTimes = player.TrackedTimes + KeyValuePair[] trackedTimes = player.TrackedTimes .GroupBy(t => t.Game) - .ToDictionary(t => t.Key.AppId, t => t.MaxBy(time => time.TimePlayed)?.TimePlayed??0); + .Select(t => new KeyValuePair(t.Key.AppId, t.MaxBy(time => time.TimePlayed)?.TimePlayed ?? 0)) + .ToArray(); return Ok(trackedTimes); }