StartWorkflowDtoValidator.cs 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using FluentValidation;
  7. using Hotline.Share.Dtos.FlowEngine;
  8. using Hotline.Application.Contracts.Validators;
  9. using Hotline.Share.Enums.FlowEngine;
  10. namespace Hotline.Application.Contracts.Validators.FlowEngine;
  11. public class StartWorkflowDtoValidator : AbstractValidator<StartWorkflowDto>
  12. {
  13. public StartWorkflowDtoValidator()
  14. {
  15. //RuleFor(d => d.DefinitionCode)
  16. // .NotEmpty().When(d => string.IsNullOrEmpty(d.DefinitionModuleCode));
  17. //RuleFor(d => d.DefinitionModuleCode)
  18. // .NotEmpty().When(d => string.IsNullOrEmpty(d.DefinitionCode));
  19. //RuleFor(d => d.DefinitionModuleCode).NotEmpty();
  20. //RuleFor(d => d.Title).NotEmpty();
  21. Include(new BasicWorkflowDtoValidator());
  22. RuleFor(d => d.NextStepCode).NotEmpty();
  23. RuleFor(d => d.IsSms).NotNull();
  24. RuleFor(d => d.IsStartCountersign).NotNull();
  25. RuleFor(d => d.NextHandlers.Count).LessThanOrEqualTo(1)
  26. .Unless(d => d.IsStartCountersign);
  27. }
  28. }