added category change for downloads with no additional hardlinks
This commit is contained in:
@@ -8,11 +8,17 @@ public sealed record DownloadCleanerConfig : IJobConfig
|
||||
public const string SectionName = "DownloadCleaner";
|
||||
|
||||
public bool Enabled { get; init; }
|
||||
|
||||
public List<Category>? Categories { get; init; }
|
||||
|
||||
public List<CleanCategory>? Categories { get; init; }
|
||||
|
||||
[ConfigurationKeyName("DELETE_PRIVATE")]
|
||||
public bool DeletePrivate { get; set; }
|
||||
public bool DeletePrivate { get; init; }
|
||||
|
||||
[ConfigurationKeyName("NO_HARDLINKS_CATEGORY")]
|
||||
public string NoHardlinksCategory { get; init; } = "";
|
||||
|
||||
[ConfigurationKeyName("HARDLINK_CATEGORIES")]
|
||||
public List<string>? HardlinkCategories { get; init; }
|
||||
|
||||
public void Validate()
|
||||
{
|
||||
@@ -32,5 +38,25 @@ public sealed record DownloadCleanerConfig : IJobConfig
|
||||
}
|
||||
|
||||
Categories?.ForEach(x => x.Validate());
|
||||
|
||||
if (string.IsNullOrEmpty(NoHardlinksCategory))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (HardlinkCategories?.Count is null or 0)
|
||||
{
|
||||
throw new ValidationException("no categories configured");
|
||||
}
|
||||
|
||||
if (HardlinkCategories.Contains(NoHardlinksCategory))
|
||||
{
|
||||
throw new ValidationException("NO_HARDLINKS_CATEGORY is present in the list of filtered categories");
|
||||
}
|
||||
|
||||
if (HardlinkCategories.Any(string.IsNullOrEmpty))
|
||||
{
|
||||
throw new ValidationException("empty hardlink filter category found");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user