refactor: Rename QualityProfileConfig (#135)

pull/139/head
voltron4lyfe 2 years ago committed by GitHub
parent 18074b6619
commit e1e3afff02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -74,7 +74,7 @@ public class GuideProcessorTest
"abc", // no score "abc", // no score
"not in guide 1" "not in guide 1"
}, },
QualityProfiles = new List<QualityProfileConfig> QualityProfiles = new List<QualityProfileScoreConfig>
{ {
new() {Name = "profile1"}, new() {Name = "profile1"},
new() {Name = "profile2", Score = -1234} new() {Name = "profile2", Score = -1234}
@ -87,7 +87,7 @@ public class GuideProcessorTest
"abc", // no score "abc", // no score
"not in guide 2" "not in guide 2"
}, },
QualityProfiles = new List<QualityProfileConfig> QualityProfiles = new List<QualityProfileScoreConfig>
{ {
new() {Name = "profile3"}, new() {Name = "profile3"},
new() {Name = "profile4", Score = 5678} new() {Name = "profile4", Score = 5678}

@ -166,7 +166,7 @@ public class CustomFormatStepTest
new() new()
{ {
TrashIds = new List<string> {"id1"}, TrashIds = new List<string> {"id1"},
QualityProfiles = new List<QualityProfileConfig> QualityProfiles = new List<QualityProfileScoreConfig>
{ {
new() {Name = "profile", Score = 200} new() {Name = "profile", Score = 200}
} }

@ -22,7 +22,7 @@ public class QualityProfileStepTest
{ {
NewCf.Processed("name1", "id1") NewCf.Processed("name1", "id1")
}, },
QualityProfiles = new List<QualityProfileConfig> QualityProfiles = new List<QualityProfileScoreConfig>
{ {
new() {Name = "profile1"} new() {Name = "profile1"}
} }
@ -47,7 +47,7 @@ public class QualityProfileStepTest
{ {
NewCf.Processed("", "id1", 100) NewCf.Processed("", "id1", 100)
}, },
QualityProfiles = new List<QualityProfileConfig> QualityProfiles = new List<QualityProfileScoreConfig>
{ {
new() {Name = "profile1", Score = 50} new() {Name = "profile1", Score = 50}
} }
@ -76,7 +76,7 @@ public class QualityProfileStepTest
{ {
NewCf.Processed("", "id1", 100) NewCf.Processed("", "id1", 100)
}, },
QualityProfiles = new List<QualityProfileConfig> QualityProfiles = new List<QualityProfileScoreConfig>
{ {
new() {Name = "profile1"}, new() {Name = "profile1"},
new() {Name = "profile2", Score = null} new() {Name = "profile2", Score = null}
@ -111,7 +111,7 @@ public class QualityProfileStepTest
{ {
NewCf.Processed("name1", "id1", 0) NewCf.Processed("name1", "id1", 0)
}, },
QualityProfiles = new List<QualityProfileConfig> QualityProfiles = new List<QualityProfileScoreConfig>
{ {
new() {Name = "profile1"} new() {Name = "profile1"}
} }

@ -80,7 +80,7 @@ public class RadarrConfigurationTest
new() new()
{ {
TrashIds = new List<string> {"required value"}, TrashIds = new List<string> {"required value"},
QualityProfiles = new List<QualityProfileConfig> QualityProfiles = new List<QualityProfileScoreConfig>
{ {
new() {Name = "required value"} new() {Name = "required value"}
} }

@ -6,7 +6,10 @@ public abstract class ServiceConfiguration : IServiceConfiguration
{ {
public string BaseUrl { get; init; } = ""; public string BaseUrl { get; init; } = "";
public string ApiKey { get; init; } = ""; public string ApiKey { get; init; } = "";
public ICollection<CustomFormatConfig> CustomFormats { get; init; } = new List<CustomFormatConfig>();
public ICollection<CustomFormatConfig> CustomFormats { get; init; } =
new List<CustomFormatConfig>();
public bool DeleteOldCustomFormats { get; init; } public bool DeleteOldCustomFormats { get; init; }
} }
@ -14,11 +17,13 @@ public abstract class ServiceConfiguration : IServiceConfiguration
public class CustomFormatConfig public class CustomFormatConfig
{ {
public ICollection<string> TrashIds { get; init; } = new List<string>(); public ICollection<string> TrashIds { get; init; } = new List<string>();
public ICollection<QualityProfileConfig> QualityProfiles { get; init; } = new List<QualityProfileConfig>();
public ICollection<QualityProfileScoreConfig> QualityProfiles { get; init; } =
new List<QualityProfileScoreConfig>();
} }
[UsedImplicitly(ImplicitUseTargetFlags.WithMembers)] [UsedImplicitly(ImplicitUseTargetFlags.WithMembers)]
public class QualityProfileConfig public class QualityProfileScoreConfig
{ {
public string Name { get; init; } = ""; public string Name { get; init; } = "";
public int? Score { get; init; } public int? Score { get; init; }

@ -7,6 +7,6 @@ public class ProcessedConfigData
public ICollection<ProcessedCustomFormatData> CustomFormats { get; init; } public ICollection<ProcessedCustomFormatData> CustomFormats { get; init; }
= new List<ProcessedCustomFormatData>(); = new List<ProcessedCustomFormatData>();
public ICollection<QualityProfileConfig> QualityProfiles { get; init; } public ICollection<QualityProfileScoreConfig> QualityProfiles { get; init; }
= new List<QualityProfileConfig>(); = new List<QualityProfileScoreConfig>();
} }

@ -25,17 +25,17 @@ internal class CustomFormatConfigValidator : AbstractValidator<CustomFormatConfi
{ {
public CustomFormatConfigValidator( public CustomFormatConfigValidator(
IRadarrValidationMessages messages, IRadarrValidationMessages messages,
IValidator<QualityProfileConfig> qualityProfileConfigValidator) IValidator<QualityProfileScoreConfig> qualityProfileScoreConfigValidator)
{ {
RuleFor(x => x.TrashIds).NotEmpty().WithMessage(messages.CustomFormatTrashIds); RuleFor(x => x.TrashIds).NotEmpty().WithMessage(messages.CustomFormatTrashIds);
RuleForEach(x => x.QualityProfiles).SetValidator(qualityProfileConfigValidator); RuleForEach(x => x.QualityProfiles).SetValidator(qualityProfileScoreConfigValidator);
} }
} }
[UsedImplicitly] [UsedImplicitly]
internal class QualityProfileConfigValidator : AbstractValidator<QualityProfileConfig> internal class QualityProfileScoreConfigValidator : AbstractValidator<QualityProfileScoreConfig>
{ {
public QualityProfileConfigValidator(IRadarrValidationMessages messages) public QualityProfileScoreConfigValidator(IRadarrValidationMessages messages)
{ {
RuleFor(x => x.Name).NotEmpty().WithMessage(messages.QualityProfileName); RuleFor(x => x.Name).NotEmpty().WithMessage(messages.QualityProfileName);
} }

Loading…
Cancel
Save