Skip to content

Commit

Permalink
DI is difficult
Browse files Browse the repository at this point in the history
  • Loading branch information
NixFey committed Jan 8, 2025
1 parent c0d085b commit 66f2cfe
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions FiMAdminApi/Endpoints/EventsEndpoints.cs
Original file line number Diff line number Diff line change
Expand Up @@ -252,10 +252,11 @@ private static async Task<Results<Ok<EventTeam>, NotFound, ForbidHttpResult, Val
[FromRoute] int eventTeamId,
[FromBody] UpdateEventTeamRequest request,
[FromServices] DataContext dbContext,
[FromServices] IServiceProvider serviceProvider,
ClaimsPrincipal user,
[FromServices] IAuthorizationService authSvc)
{
var (isValid, validationErrors) = await MiniValidator.TryValidateAsync(request);
var (isValid, validationErrors) = await MiniValidator.TryValidateAsync(request, serviceProvider);
if (!isValid) return TypedResults.ValidationProblem(validationErrors);

var evt = await dbContext.Events.Include(e => e.Season).FirstOrDefaultAsync(e => e.Id == eventId);
Expand Down Expand Up @@ -344,7 +345,7 @@ public IEnumerable<ValidationResult> Validate(ValidationContext validationContex
.Where(s => s.Id == StatusId).Select(s => s.Id).FirstOrDefault();
if (string.IsNullOrEmpty(matchingStatus))
{
yield return new ValidationResult($"Unknown status '{StatusId}'.", new[] { nameof(StatusId) });
yield return new ValidationResult($"Unknown status '{StatusId}'.", [nameof(StatusId)]);
}
else
{
Expand Down

0 comments on commit 66f2cfe

Please sign in to comment.