Initial import
This commit is contained in:
+23
@@ -0,0 +1,23 @@
|
||||
using FluentValidation;
|
||||
|
||||
namespace MinAttest.Application.Features.Attests.Commands;
|
||||
|
||||
public class EmployerIssueAttestCommandValidator : AbstractValidator<EmployerIssueAttestCommand>
|
||||
{
|
||||
public EmployerIssueAttestCommandValidator()
|
||||
{
|
||||
RuleFor(x => x.EmployerId).NotEqual(Guid.Empty);
|
||||
RuleFor(x => x.Request.PersonId).NotEqual(Guid.Empty);
|
||||
RuleFor(x => x.Request.Title).NotEmpty().MaximumLength(200);
|
||||
RuleFor(x => x.Request.BlobPath).MaximumLength(500);
|
||||
RuleFor(x => x.Request.From).LessThanOrEqualTo(x => x.Request.To);
|
||||
RuleFor(x => x.Request)
|
||||
.Must(r => !string.IsNullOrWhiteSpace(r.BlobPath) || !string.IsNullOrWhiteSpace(r.ContentBase64))
|
||||
.WithMessage("Either BlobPath or ContentBase64 must be provided");
|
||||
When(x => !string.IsNullOrWhiteSpace(x.Request.ContentBase64), () =>
|
||||
{
|
||||
RuleFor(x => x.Request.ContentType).NotEmpty().MaximumLength(255);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user