Introduced AuthScopedValidator to enforce non-empty AddedWho on IAuthScoped entities with a clear error message. Registered all validators from the assembly in DI to enable automatic validation for authentication-scoped entities.
15 lines
465 B
C#
15 lines
465 B
C#
using FluentValidation;
|
|
using ReC.Application.Common.Interfaces;
|
|
|
|
namespace ReC.Application.Common.Validations;
|
|
|
|
public class AuthScopedValidator : AbstractValidator<IAuthScoped>
|
|
{
|
|
public AuthScopedValidator()
|
|
{
|
|
RuleFor(x => x.AddedWho)
|
|
.NotEmpty()
|
|
.WithMessage("The 'AddedWho' field is required. A missing value may indicate an API configuration issue. Please contact your system administrator for assistance.");
|
|
}
|
|
}
|