Format ./web/backend/Shared/Shared.Application

This commit is contained in:
Aaron Po
2026-06-20 15:14:53 -04:00
parent 6f8e5dc722
commit cee2917556
4 changed files with 12 additions and 15 deletions

View File

@@ -19,20 +19,20 @@ public class ValidationBehavior<TRequest, TResponse>(IEnumerable<IValidator<TReq
CancellationToken cancellationToken
)
{
if (!validators.Any()) return await next();
if (!validators.Any())
return await next();
ValidationContext<TRequest> context = new(request);
List<ValidationFailure> failures = (
await Task.WhenAll(
validators.Select(v => v.ValidateAsync(context, cancellationToken))
)
)
await Task.WhenAll(validators.Select(v => v.ValidateAsync(context, cancellationToken)))
)
.SelectMany(result => result.Errors)
.Where(failure => failure != null)
.ToList();
if (failures.Count > 0) throw new ValidationException(failures);
if (failures.Count > 0)
throw new ValidationException(failures);
return await next();
}

View File

@@ -6,8 +6,5 @@ namespace Shared.Application.Emails;
/// Cross-slice command sent by Features.Auth and handled by Features.Emails to dispatch a
/// registration confirmation email, without either slice taking a project reference on the other.
/// </summary>
public record SendRegistrationEmailCommand(
string FirstName,
string Email,
string ConfirmationToken
) : IRequest;
public record SendRegistrationEmailCommand(string FirstName, string Email, string ConfirmationToken)
: IRequest;

View File

@@ -7,7 +7,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="MediatR" Version="12.4.1"/>
<PackageReference Include="FluentValidation" Version="11.3.0"/>
<PackageReference Include="MediatR" Version="12.4.1" />
<PackageReference Include="FluentValidation" Version="11.3.0" />
</ItemGroup>
</Project>