2020-05-14 02:19:22 +00:00
|
|
|
using FluentValidation;
|
|
|
|
using FluentValidation.Results;
|
|
|
|
using NzbDrone.Core.Validation.Paths;
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.Movies
|
|
|
|
{
|
|
|
|
public interface IAddMovieValidator
|
|
|
|
{
|
|
|
|
ValidationResult Validate(Movie instance);
|
|
|
|
}
|
|
|
|
|
|
|
|
public class AddMovieValidator : AbstractValidator<Movie>, IAddMovieValidator
|
|
|
|
{
|
|
|
|
public AddMovieValidator(RootFolderValidator rootFolderValidator,
|
2020-12-08 03:39:52 +00:00
|
|
|
RecycleBinValidator recycleBinValidator,
|
|
|
|
MoviePathValidator moviePathValidator,
|
2022-03-20 15:55:47 +00:00
|
|
|
MovieAncestorValidator movieAncestorValidator)
|
2020-05-14 02:19:22 +00:00
|
|
|
{
|
2023-04-01 13:03:53 +00:00
|
|
|
RuleFor(c => c.Path).Cascade(CascadeMode.Stop)
|
2020-05-14 02:19:22 +00:00
|
|
|
.IsValidPath()
|
|
|
|
.SetValidator(rootFolderValidator)
|
2020-12-08 03:39:52 +00:00
|
|
|
.SetValidator(recycleBinValidator)
|
2020-05-14 02:19:22 +00:00
|
|
|
.SetValidator(moviePathValidator)
|
|
|
|
.SetValidator(movieAncestorValidator);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|