23 lines
669 B
C#
23 lines
669 B
C#
using FluentValidation;
|
|
using Musify.Api.DataTransferObjects.Albums;
|
|
|
|
namespace Musify.Api.Validators.Albums
|
|
{
|
|
public sealed class UpdateAlbumRequestValidator : AbstractValidator<UpdateAlbumRequest>
|
|
{
|
|
public UpdateAlbumRequestValidator()
|
|
{
|
|
RuleFor(x => x.Title)
|
|
.NotEmpty()
|
|
.MaximumLength(Limits.AlbumTitle);
|
|
|
|
RuleFor(x => x.Description)
|
|
.MaximumLength(Limits.Description);
|
|
|
|
RuleFor(x => x.ReleaseYear)
|
|
.InclusiveBetween(Limits.EarliestReleaseYear, Limits.LatestReleaseYear)
|
|
.When(x => x.ReleaseYear.HasValue);
|
|
}
|
|
}
|
|
}
|