Guid and long route constraints, id/trackId parameter names, Update*Request without the New prefix, sentence-case operation summaries, shared security scheme id and a single Limits class.
21 lines
634 B
C#
21 lines
634 B
C#
using FluentValidation;
|
|
using Musify.Api.DataTransferObjects;
|
|
using Musify.Application.Configuration;
|
|
|
|
namespace Musify.Api.Validators;
|
|
|
|
public sealed class PictureUploadRequestValidator : AbstractValidator<PictureUploadRequest>
|
|
{
|
|
public PictureUploadRequestValidator(UploadIntentConfiguration uploadConfiguration)
|
|
{
|
|
RuleFor(x => x.FileType)
|
|
.MustBeFileType(Uploads.PictureFileTypes);
|
|
|
|
RuleFor(x => x.ContentType)
|
|
.MustBeContentType(Uploads.PictureContentTypes);
|
|
|
|
RuleFor(x => x.ExpectedSizeBytes)
|
|
.MustBeValidUploadSize(uploadConfiguration.MaxUploadBytes);
|
|
}
|
|
}
|