Code format
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
using GameList.Data;
|
||||
using GameList.Domain;
|
||||
using GameList.Contracts;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using GameList.Infrastructure;
|
||||
@@ -12,25 +11,13 @@ public static class AdminEndpoints
|
||||
{
|
||||
var admin = app.MapGroup("/api/admin").RequireAuthorization().AddEndpointFilter<AdminOnlyFilter>();
|
||||
|
||||
admin.MapPost("/results", async ([FromBody] ResultsOpenRequest request, AdminWorkflowService service) =>
|
||||
{
|
||||
return await service.SetResultsOpenAsync(request.ResultsOpen);
|
||||
});
|
||||
admin.MapPost("/results", async ([FromBody] ResultsOpenRequest request, AdminWorkflowService service) => await service.SetResultsOpenAsync(request.ResultsOpen));
|
||||
|
||||
admin.MapGet("/vote-status", async (AdminWorkflowService service) =>
|
||||
{
|
||||
return await service.GetVoteStatusAsync();
|
||||
});
|
||||
admin.MapGet("/vote-status", async (AdminWorkflowService service) => await service.GetVoteStatusAsync());
|
||||
|
||||
admin.MapPost("/joker", async ([FromBody] GrantJokerRequest request, AdminWorkflowService service) =>
|
||||
{
|
||||
return await service.GrantJokerAsync(request.PlayerId);
|
||||
});
|
||||
admin.MapPost("/joker", async ([FromBody] GrantJokerRequest request, AdminWorkflowService service) => await service.GrantJokerAsync(request.PlayerId));
|
||||
|
||||
admin.MapDelete("/players/{playerId:guid}", async (Guid playerId, AdminWorkflowService service) =>
|
||||
{
|
||||
return await service.DeletePlayerAsync(playerId);
|
||||
});
|
||||
admin.MapDelete("/players/{playerId:guid}", async (Guid playerId, AdminWorkflowService service) => await service.DeletePlayerAsync(playerId));
|
||||
|
||||
admin.MapPost("/link-suggestions", async ([FromBody] LinkSuggestionsRequest request, HttpContext ctx, AppDbContext db, AdminWorkflowService service) =>
|
||||
{
|
||||
@@ -50,15 +37,9 @@ public static class AdminEndpoints
|
||||
return await service.UnlinkSuggestionsAsync(player.Id, request.SuggestionId);
|
||||
});
|
||||
|
||||
admin.MapPost("/reset", async (AdminWorkflowService service) =>
|
||||
{
|
||||
return await service.ResetAsync();
|
||||
});
|
||||
admin.MapPost("/reset", async (AdminWorkflowService service) => await service.ResetAsync());
|
||||
|
||||
admin.MapPost("/factory-reset", async (AdminWorkflowService service) =>
|
||||
{
|
||||
return await service.FactoryResetAsync();
|
||||
});
|
||||
admin.MapPost("/factory-reset", async (AdminWorkflowService service) => await service.FactoryResetAsync());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ internal static class AuthValidator
|
||||
|
||||
public static bool TryValidateRegistration(RegisterRequest request, out ValidatedRegistration validated, out string error)
|
||||
{
|
||||
var username = (request.Username ?? string.Empty).Trim();
|
||||
var username = (request.Username).Trim();
|
||||
if (string.IsNullOrWhiteSpace(username) || username.Length > MaxUsernameLength)
|
||||
{
|
||||
validated = default;
|
||||
@@ -48,7 +48,7 @@ internal static class AuthValidator
|
||||
|
||||
public static bool TryValidateLogin(LoginRequest request, out string username, out string normalizedUsername, out string error)
|
||||
{
|
||||
username = (request.Username ?? string.Empty).Trim();
|
||||
username = (request.Username).Trim();
|
||||
normalizedUsername = string.Empty;
|
||||
|
||||
if (string.IsNullOrWhiteSpace(username) || string.IsNullOrWhiteSpace(request.Password))
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using GameList.Data;
|
||||
using GameList.Domain;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Security.Claims;
|
||||
|
||||
|
||||
@@ -99,14 +99,12 @@ public static class StateEndpoints
|
||||
private static Phase NextPhase(Phase current) => current switch
|
||||
{
|
||||
Phase.Suggest => Phase.Vote,
|
||||
Phase.Vote => Phase.Results,
|
||||
_ => Phase.Results
|
||||
};
|
||||
|
||||
private static Phase PrevPhase(Phase current) => current switch
|
||||
{
|
||||
Phase.Results => Phase.Vote,
|
||||
Phase.Vote => Phase.Suggest,
|
||||
_ => Phase.Suggest
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user