diff --git a/Program.cs b/Program.cs index ad69348..a8057f0 100644 --- a/Program.cs +++ b/Program.cs @@ -177,6 +177,20 @@ api.MapGet("/suggestions/all", async (AppDbContext db) => var all = await db.Suggestions.AsNoTracking() .Include(s => s.Player) + .Select(s => new + { + s.Id, + s.Name, + s.Genre, + s.Description, + s.ScreenshotUrl, + s.YoutubeUrl, + Author = s.Player!.DisplayName, + s.CreatedAt + }) + .ToListAsync(); + + var ordered = all .OrderBy(s => s.CreatedAt) .Select(s => new { @@ -186,11 +200,10 @@ api.MapGet("/suggestions/all", async (AppDbContext db) => s.Description, s.ScreenshotUrl, s.YoutubeUrl, - Author = s.Player!.DisplayName - }) - .ToListAsync(); + s.Author + }); - return Results.Ok(all); + return Results.Ok(ordered); }); api.MapGet("/votes/mine", async (HttpContext ctx, AppDbContext db) =>