| | | 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="VerifyEmailCommand" /> (UC-14). Whether the token exists, has |
| | | 8 | | /// expired, or has been used is the handler's business (AF-14a…AF-14c). |
| | | 9 | | /// </summary> |
| | | 10 | | /// <remarks> |
| | | 11 | | /// UC-14 defines no alternative flow for a malformed request — unlike UC-13's AF-13d — but NFR-10 |
| | | 12 | | /// requires every input to be validated. Nothing is contradicted by the rule: an absent token |
| | | 13 | | /// answers 400 here, and would answer 400 as AF-14c if it reached the lookup. |
| | | 14 | | /// </remarks> |
| | | 15 | | public class VerifyEmailCommandValidator : AbstractValidator<VerifyEmailCommand> |
| | | 16 | | { |
| | 118 | 17 | | public VerifyEmailCommandValidator() |
| | | 18 | | { |
| | 118 | 19 | | RuleFor(command => command.Token) |
| | 118 | 20 | | .NotEmpty().WithMessage(AuthMessages.TokenRequired); |
| | 118 | 21 | | } |
| | | 22 | | } |