Add DeleteObjectProcedureValidator with validation rules
Introduced DeleteObjectProcedureValidator using FluentValidation to ensure Start is greater than 0 and End is greater than or equal to Start, with custom error messages for each rule.
This commit is contained in:
@@ -0,0 +1,18 @@
|
|||||||
|
using FluentValidation;
|
||||||
|
using ReC.Application.Common.Procedures.DeleteProcedure;
|
||||||
|
|
||||||
|
namespace ReC.Application.Common.Validations;
|
||||||
|
|
||||||
|
public class DeleteObjectProcedureValidator : AbstractValidator<DeleteObjectProcedure>
|
||||||
|
{
|
||||||
|
public DeleteObjectProcedureValidator()
|
||||||
|
{
|
||||||
|
RuleFor(x => x.Start)
|
||||||
|
.GreaterThan(0)
|
||||||
|
.WithMessage("Start GUID/ID must be greater than 0.");
|
||||||
|
|
||||||
|
RuleFor(x => x.End)
|
||||||
|
.GreaterThanOrEqualTo(x => x.Start)
|
||||||
|
.WithMessage("End GUID/ID must be greater than or equal to Start GUID/ID.");
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user