GET /tracks/users/{userId} accepts repeated status values and returns the
albums each track belongs to. GET /tracks/users/{userId}/status-counts,
GET /albums/{id}/tracks/ids and DELETE /tracks with a list of track ids
are new.
22 lines
632 B
C#
22 lines
632 B
C#
using FluentValidation;
|
|
using Musify.Api.DataTransferObjects.Tracks;
|
|
|
|
namespace Musify.Api.Validators.Tracks
|
|
{
|
|
public sealed class DeleteTracksRequestValidator : AbstractValidator<DeleteTracksRequest>
|
|
{
|
|
public const int MaxTracksPerRequest = 100;
|
|
|
|
public DeleteTracksRequestValidator()
|
|
{
|
|
RuleFor(x => x.TrackIds)
|
|
.NotEmpty()
|
|
.Must(ids => ids.Count <= MaxTracksPerRequest)
|
|
.WithMessage($"At most {MaxTracksPerRequest} tracks can be deleted at once.");
|
|
|
|
RuleForEach(x => x.TrackIds)
|
|
.NotEmpty();
|
|
}
|
|
}
|
|
}
|