Add ReadProfileViewQueryValidator for Id validation
Introduced ReadProfileViewQueryValidator using FluentValidation to ensure the Id property, if provided, is greater than 0. Includes a custom error message for invalid Id values.
This commit is contained in:
@@ -0,0 +1,15 @@
|
|||||||
|
using FluentValidation;
|
||||||
|
using ReC.Application.Profile.Queries;
|
||||||
|
|
||||||
|
namespace ReC.Application.Common.Validations;
|
||||||
|
|
||||||
|
public class ReadProfileViewQueryValidator : AbstractValidator<ReadProfileViewQuery>
|
||||||
|
{
|
||||||
|
public ReadProfileViewQueryValidator()
|
||||||
|
{
|
||||||
|
RuleFor(x => x.Id)
|
||||||
|
.GreaterThan(0)
|
||||||
|
.When(x => x.Id.HasValue)
|
||||||
|
.WithMessage("Id must be greater than 0.");
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user