Design Prot Merge #1
@@ -8,10 +8,12 @@ public sealed class UpdatePlayListRequestValidator : AbstractValidator<UpdatePla
|
|||||||
public UpdatePlayListRequestValidator()
|
public UpdatePlayListRequestValidator()
|
||||||
{
|
{
|
||||||
RuleFor(x => x.NewName)
|
RuleFor(x => x.NewName)
|
||||||
|
.NotEmpty()
|
||||||
.MaximumLength(50)
|
.MaximumLength(50)
|
||||||
.When(x => x.NewName is not null);
|
.When(x => x.NewName is not null);
|
||||||
|
|
||||||
RuleFor(x => x.NewDescription)
|
RuleFor(x => x.NewDescription)
|
||||||
|
.NotEmpty()
|
||||||
.MaximumLength(256)
|
.MaximumLength(256)
|
||||||
.When(x => x.NewDescription is not null);
|
.When(x => x.NewDescription is not null);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,13 +45,13 @@ namespace Musify.Application.PlayLists
|
|||||||
return Error.Unauthorized();
|
return Error.Unauthorized();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (request.NewName is not null)
|
if (!string.IsNullOrWhiteSpace(request.NewName))
|
||||||
{
|
{
|
||||||
playListEntity.Name = request.NewName;
|
playListEntity.Name = request.NewName;
|
||||||
playListEntity.NormalizedName = request.NewName.Trim().ToUpperInvariant();
|
playListEntity.NormalizedName = request.NewName.Trim().ToUpperInvariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (request.NewDescription is not null)
|
if (!string.IsNullOrWhiteSpace(request.NewDescription))
|
||||||
{
|
{
|
||||||
playListEntity.Description = request.NewDescription;
|
playListEntity.Description = request.NewDescription;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user