mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-16 10:03:51 -07:00
New: Updated FluentValidation to 8.4.0
Co-Authored-By: taloth <taloth@users.noreply.github.com>
This commit is contained in:
parent
22fb4a1801
commit
40483c1bbb
11 changed files with 19 additions and 46 deletions
|
@ -32,14 +32,12 @@ namespace Lidarr.Api.V1.Profiles.Delay
|
|||
SharedValidator.RuleFor(d => d.UsenetDelay).GreaterThanOrEqualTo(0);
|
||||
SharedValidator.RuleFor(d => d.TorrentDelay).GreaterThanOrEqualTo(0);
|
||||
|
||||
SharedValidator.Custom(delayProfile =>
|
||||
SharedValidator.RuleFor(d => d).Custom((delayProfile, context) =>
|
||||
{
|
||||
if (!delayProfile.EnableUsenet && !delayProfile.EnableTorrent)
|
||||
{
|
||||
return new ValidationFailure("", "Either Usenet or Torrent should be enabled");
|
||||
context.AddFailure("Either Usenet or Torrent should be enabled");
|
||||
}
|
||||
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue