From 68b3eb53c078dab5e89722eea32d4de9d1b1c8b0 Mon Sep 17 00:00:00 2001 From: TekH Date: Thu, 16 Apr 2026 14:39:26 +0200 Subject: [PATCH] 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. --- .../Validations/ReadProfileViewQueryValidator.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/ReC.Application/Common/Validations/ReadProfileViewQueryValidator.cs diff --git a/src/ReC.Application/Common/Validations/ReadProfileViewQueryValidator.cs b/src/ReC.Application/Common/Validations/ReadProfileViewQueryValidator.cs new file mode 100644 index 0000000..e5f7e86 --- /dev/null +++ b/src/ReC.Application/Common/Validations/ReadProfileViewQueryValidator.cs @@ -0,0 +1,15 @@ +using FluentValidation; +using ReC.Application.Profile.Queries; + +namespace ReC.Application.Common.Validations; + +public class ReadProfileViewQueryValidator : AbstractValidator +{ + public ReadProfileViewQueryValidator() + { + RuleFor(x => x.Id) + .GreaterThan(0) + .When(x => x.Id.HasValue) + .WithMessage("Id must be greater than 0."); + } +}