From 66f2cfec67be49cdafd2760061071a1cc3ac0a6a Mon Sep 17 00:00:00 2001 From: evanlihou Date: Tue, 7 Jan 2025 20:46:21 -0500 Subject: [PATCH] DI is difficult --- FiMAdminApi/Endpoints/EventsEndpoints.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/FiMAdminApi/Endpoints/EventsEndpoints.cs b/FiMAdminApi/Endpoints/EventsEndpoints.cs index e06cb55..5e2e8c0 100644 --- a/FiMAdminApi/Endpoints/EventsEndpoints.cs +++ b/FiMAdminApi/Endpoints/EventsEndpoints.cs @@ -252,10 +252,11 @@ private static async Task, 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); @@ -344,7 +345,7 @@ public IEnumerable 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 {