Code formatting
This commit is contained in:
@@ -8,16 +8,20 @@ public static class ResultsEndpoints
|
||||
{
|
||||
public static void MapResultsEndpoints(this IEndpointRouteBuilder app)
|
||||
{
|
||||
app.MapGet("/api/results", async (HttpContext ctx, AppDbContext db) =>
|
||||
app.MapGet(
|
||||
"/api/results",
|
||||
async (HttpContext ctx, AppDbContext db) =>
|
||||
{
|
||||
var phase = await EndpointHelpers.GetPhase(db);
|
||||
if (phase != Phase.Results)
|
||||
return EndpointHelpers.PhaseMismatch(Phase.Results, phase);
|
||||
|
||||
var player = await EndpointHelpers.GetAuthenticatedPlayer(ctx, db);
|
||||
if (player is null) return Results.Unauthorized();
|
||||
if (player is null)
|
||||
return Results.Unauthorized();
|
||||
|
||||
var results = await db.Suggestions.AsNoTracking()
|
||||
var results = await db
|
||||
.Suggestions.AsNoTracking()
|
||||
.Include(s => s.Player)
|
||||
.Include(s => s.Votes)
|
||||
.Select(s => new
|
||||
@@ -34,12 +38,13 @@ public static class ResultsEndpoints
|
||||
s.YoutubeUrl,
|
||||
s.GameUrl,
|
||||
s.Description,
|
||||
s.Genre
|
||||
s.Genre,
|
||||
})
|
||||
.OrderByDescending(r => r.Total)
|
||||
.OrderByDescending(r => r.Average)
|
||||
.ToListAsync();
|
||||
|
||||
return Results.Ok(results);
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user