Owners invite existing users to coauthor a track; invitees accept or reject, and either side can remove a coauthor. Only accepted coauthors appear in track responses and in the coauthor's public track list. The owner also receives the full invitation list with statuses on the user tracks response.
22 lines
638 B
C#
22 lines
638 B
C#
using FluentValidation;
|
|
using Musify.Api.DataTransferObjects.Tracks;
|
|
|
|
namespace Musify.Api.Validators.Tracks
|
|
{
|
|
public sealed class InviteCoauthorsRequestValidator : AbstractValidator<InviteCoauthorsRequest>
|
|
{
|
|
public const int MaxUsersPerRequest = 20;
|
|
|
|
public InviteCoauthorsRequestValidator()
|
|
{
|
|
RuleFor(x => x.UserIds)
|
|
.NotEmpty()
|
|
.Must(ids => ids.Count <= MaxUsersPerRequest)
|
|
.WithMessage($"At most {MaxUsersPerRequest} users can be invited at once.");
|
|
|
|
RuleForEach(x => x.UserIds)
|
|
.GreaterThan(0);
|
|
}
|
|
}
|
|
}
|