1
0
Fork 0
mirror of https://github.com/lidarr/Lidarr synced 2024-12-23 16:23:13 +00:00

Added: Validate Set Profiles Exist when Adding Artist

Fixes #281
This commit is contained in:
Qstick 2018-04-07 22:43:10 -04:00
parent fde276f000
commit 321d99a597

View file

@ -5,6 +5,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NzbDrone.Core.Validation;
namespace NzbDrone.Core.Music
{
@ -17,7 +18,10 @@ public class AddArtistValidator : AbstractValidator<Artist>, IAddArtistValidator
{
public AddArtistValidator(RootFolderValidator rootFolderValidator,
ArtistPathValidator artistPathValidator,
ArtistAncestorValidator artistAncestorValidator)
ArtistAncestorValidator artistAncestorValidator,
ProfileExistsValidator profileExistsValidator,
LanguageProfileExistsValidator languageProfileExistsValidator,
MetadataProfileExistsValidator metadataProfileExistsValidator)
{
RuleFor(c => c.Path).Cascade(CascadeMode.StopOnFirstFailure)
.IsValidPath()
@ -25,6 +29,12 @@ public AddArtistValidator(RootFolderValidator rootFolderValidator,
.SetValidator(artistPathValidator)
.SetValidator(artistAncestorValidator);
RuleFor(c => c.ProfileId).SetValidator(profileExistsValidator);
RuleFor(c => c.LanguageProfileId).SetValidator(languageProfileExistsValidator);
RuleFor(c => c.MetadataProfileId).SetValidator(metadataProfileExistsValidator);
}
}
}