Order suggestions client-side to avoid SQLite DateTimeOffset ORDER BY

This commit is contained in:
2026-01-28 14:59:45 +01:00
parent a4b86bb1ca
commit 37c3eed552

View File

@@ -177,6 +177,20 @@ api.MapGet("/suggestions/all", async (AppDbContext db) =>
var all = await db.Suggestions.AsNoTracking() var all = await db.Suggestions.AsNoTracking()
.Include(s => s.Player) .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) .OrderBy(s => s.CreatedAt)
.Select(s => new .Select(s => new
{ {
@@ -186,11 +200,10 @@ api.MapGet("/suggestions/all", async (AppDbContext db) =>
s.Description, s.Description,
s.ScreenshotUrl, s.ScreenshotUrl,
s.YoutubeUrl, s.YoutubeUrl,
Author = s.Player!.DisplayName s.Author
}) });
.ToListAsync();
return Results.Ok(all); return Results.Ok(ordered);
}); });
api.MapGet("/votes/mine", async (HttpContext ctx, AppDbContext db) => api.MapGet("/votes/mine", async (HttpContext ctx, AppDbContext db) =>