From b9f5a3f10c1d35010e32ed93be45ed3ce30c6eba Mon Sep 17 00:00:00 2001 From: TekH Date: Mon, 8 Dec 2025 11:28:43 +0100 Subject: [PATCH] Add DeleteOutResCommandValidator for input validation Introduce DeleteOutResCommandValidator using FluentValidation to enforce business rules for the DeleteOutResCommand. Added a validation rule to ensure at least one of ActionId or ProfileId is provided, with a descriptive error message if neither is present. Included necessary using directives for FluentValidation and the relevant namespace. --- .../Commands/DeleteOutResCommandValidator.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/ReC.Application/OutResults/Commands/DeleteOutResCommandValidator.cs diff --git a/src/ReC.Application/OutResults/Commands/DeleteOutResCommandValidator.cs b/src/ReC.Application/OutResults/Commands/DeleteOutResCommandValidator.cs new file mode 100644 index 0000000..843a6cd --- /dev/null +++ b/src/ReC.Application/OutResults/Commands/DeleteOutResCommandValidator.cs @@ -0,0 +1,14 @@ +using FluentValidation; + +namespace ReC.Application.OutResults.Commands; + +public class DeleteOutResCommandValidator : AbstractValidator +{ + public DeleteOutResCommandValidator() + { + RuleFor(x => x) + .Must(x => x.ActionId.HasValue || x.ProfileId.HasValue) + .WithMessage("At least one of ActionId or ProfileId must be provided.") + .WithName("Identifier"); + } +} \ No newline at end of file