diff --git a/Program.cs b/Program.cs index 43dc9e8..eff18d7 100644 --- a/Program.cs +++ b/Program.cs @@ -146,10 +146,23 @@ api.MapGet("/suggestions/mine", async (HttpContext ctx, AppDbContext db) => var player = await GetOrCreatePlayer(ctx, db); var mine = await db.Suggestions.AsNoTracking() .Where(s => s.PlayerId == player.Id) - .OrderBy(s => s.CreatedAt) - .Select(s => new SuggestionDto(s.Id, s.Name, s.Genre, s.Description, s.ScreenshotUrl, s.YoutubeUrl)) + .Select(s => new + { + s.Id, + s.Name, + s.Genre, + s.Description, + s.ScreenshotUrl, + s.YoutubeUrl, + s.CreatedAt + }) .ToListAsync(); - return Results.Ok(mine); + + var ordered = mine + .OrderBy(s => s.CreatedAt) + .Select(s => new SuggestionDto(s.Id, s.Name, s.Genre, s.Description, s.ScreenshotUrl, s.YoutubeUrl)); + + return Results.Ok(ordered); }); api.MapPost("/suggestions", async ([FromBody] SuggestionRequest request, HttpContext ctx, AppDbContext db) =>