| | | 1 | | using ArturRios.Heimdall.Shared.Messages; |
| | | 2 | | using FluentValidation; |
| | | 3 | | |
| | | 4 | | namespace ArturRios.Heimdall.Command.Input.Validation; |
| | | 5 | | |
| | | 6 | | /// <summary> |
| | | 7 | | /// Shape validation for <see cref="CreateScopePermissionCommand" /> (UC-31, AF-31d). Scope |
| | | 8 | | /// existence and actor authorization are enforced by the handler. A <c>null</c> description is |
| | | 9 | | /// valid: FluentValidation's <c>MaximumLength</c> rule skips <c>null</c> arguments, so only a |
| | | 10 | | /// non-null overlong description is rejected. |
| | | 11 | | /// </summary> |
| | | 12 | | public class CreateScopePermissionCommandValidator : AbstractValidator<CreateScopePermissionCommand> |
| | | 13 | | { |
| | 31 | 14 | | public CreateScopePermissionCommandValidator() |
| | | 15 | | { |
| | 31 | 16 | | RuleFor(command => command.Name) |
| | 31 | 17 | | .NotEmpty().WithMessage(ScopePermissionMessages.NameRequired) |
| | 31 | 18 | | .MaximumLength(200).WithMessage(ScopePermissionMessages.NameTooLong); |
| | | 19 | | |
| | 31 | 20 | | RuleFor(command => command.Description) |
| | 31 | 21 | | .MaximumLength(500).WithMessage(ScopePermissionMessages.DescriptionTooLong); |
| | 31 | 22 | | } |
| | | 23 | | } |