Order /suggestions/mine client-side to avoid SQLite DateTimeOffset ordering
This commit is contained in:
19
Program.cs
19
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) =>
|
||||
|
||||
Reference in New Issue
Block a user