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.
This commit is contained in:
parent
243cc97aa2
commit
b9f5a3f10c
@ -0,0 +1,14 @@
|
||||
using FluentValidation;
|
||||
|
||||
namespace ReC.Application.OutResults.Commands;
|
||||
|
||||
public class DeleteOutResCommandValidator : AbstractValidator<DeleteOutResCommand>
|
||||
{
|
||||
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");
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user