combine arr configs #1

This commit is contained in:
Flaminel
2025-06-15 21:15:50 +03:00
parent 62eee94497
commit bf37668dcb
74 changed files with 486 additions and 703 deletions

View File

@@ -1,8 +0,0 @@
namespace Common.Configuration.Arr;
public sealed class LidarrConfig : ArrConfig
{
public override void Validate()
{
}
}

View File

@@ -1,8 +0,0 @@
namespace Common.Configuration.Arr;
public sealed class RadarrConfig : ArrConfig
{
public override void Validate()
{
}
}

View File

@@ -1,8 +0,0 @@
namespace Common.Configuration.Arr;
public sealed class SonarrConfig : ArrConfig
{
public override void Validate()
{
}
}

View File

@@ -1,9 +1,9 @@
using Common.Configuration;
using Common.Configuration.Arr;
using Common.Configuration.DownloadCleaner;
using Common.Configuration.General;
using Common.Configuration.Notification;
using Common.Configuration.QueueCleaner;
using Data.Models.Configuration.Arr;
using Data.Models.Configuration.DownloadCleaner;
using Data.Models.Configuration.General;
using Data.Models.Configuration.Notification;
using Data.Models.Configuration.QueueCleaner;
using Common.Helpers;
using Microsoft.EntityFrameworkCore;
@@ -24,11 +24,7 @@ public class DataContext : DbContext
public DbSet<DownloadCleanerConfig> DownloadCleanerConfigs { get; set; }
public DbSet<SonarrConfig> SonarrConfigs { get; set; }
public DbSet<RadarrConfig> RadarrConfigs { get; set; }
public DbSet<LidarrConfig> LidarrConfigs { get; set; }
public DbSet<ArrConfig> ArrConfigs { get; set; }
public DbSet<ArrInstance> ArrInstances { get; set; }

View File

@@ -12,7 +12,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace Data.Migrations.Data
{
[DbContext(typeof(DataContext))]
[Migration("20250614220030_InitialData")]
[Migration("20250615170420_InitialData")]
partial class InitialData
{
/// <inheritdoc />
@@ -21,7 +21,81 @@ namespace Data.Migrations.Data
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "9.0.5");
modelBuilder.Entity("Common.Configuration.Arr.ArrInstance", b =>
modelBuilder.Entity("Common.Configuration.DownloadClientConfig", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT")
.HasColumnName("id");
b.Property<bool>("Enabled")
.HasColumnType("INTEGER")
.HasColumnName("enabled");
b.Property<string>("Host")
.HasColumnType("TEXT")
.HasColumnName("host");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("name");
b.Property<string>("Password")
.HasColumnType("TEXT")
.HasColumnName("password");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("type");
b.Property<string>("TypeName")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("type_name");
b.Property<string>("UrlBase")
.HasColumnType("TEXT")
.HasColumnName("url_base");
b.Property<string>("Username")
.HasColumnType("TEXT")
.HasColumnName("username");
b.HasKey("Id")
.HasName("pk_download_clients");
b.ToTable("download_clients", (string)null);
});
modelBuilder.Entity("Data.Models.Configuration.Arr.ArrConfig", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT")
.HasColumnName("id");
b.Property<bool>("Enabled")
.HasColumnType("INTEGER")
.HasColumnName("enabled");
b.Property<short>("FailedImportMaxStrikes")
.HasColumnType("INTEGER")
.HasColumnName("failed_import_max_strikes");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("type");
b.HasKey("Id")
.HasName("pk_arr_configs");
b.ToTable("arr_configs", (string)null);
});
modelBuilder.Entity("Data.Models.Configuration.Arr.ArrInstance", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
@@ -33,112 +107,30 @@ namespace Data.Migrations.Data
.HasColumnType("TEXT")
.HasColumnName("api_key");
b.Property<Guid?>("LidarrConfigId")
b.Property<Guid>("ArrConfigId")
.HasColumnType("TEXT")
.HasColumnName("lidarr_config_id");
.HasColumnName("arr_config_id");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("name");
b.Property<Guid?>("RadarrConfigId")
.HasColumnType("TEXT")
.HasColumnName("radarr_config_id");
b.Property<Guid?>("SonarrConfigId")
.HasColumnType("TEXT")
.HasColumnName("sonarr_config_id");
b.Property<string>("Url")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("url");
b.HasKey("Id")
.HasName("pk_arr_instance");
.HasName("pk_arr_instances");
b.HasIndex("LidarrConfigId")
.HasDatabaseName("ix_arr_instance_lidarr_config_id");
b.HasIndex("ArrConfigId")
.HasDatabaseName("ix_arr_instances_arr_config_id");
b.HasIndex("RadarrConfigId")
.HasDatabaseName("ix_arr_instance_radarr_config_id");
b.HasIndex("SonarrConfigId")
.HasDatabaseName("ix_arr_instance_sonarr_config_id");
b.ToTable("arr_instance", (string)null);
b.ToTable("arr_instances", (string)null);
});
modelBuilder.Entity("Common.Configuration.Arr.LidarrConfig", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT")
.HasColumnName("id");
b.Property<bool>("Enabled")
.HasColumnType("INTEGER")
.HasColumnName("enabled");
b.Property<short>("FailedImportMaxStrikes")
.HasColumnType("INTEGER")
.HasColumnName("failed_import_max_strikes");
b.HasKey("Id")
.HasName("pk_lidarr_configs");
b.ToTable("lidarr_configs", (string)null);
});
modelBuilder.Entity("Common.Configuration.Arr.RadarrConfig", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT")
.HasColumnName("id");
b.Property<bool>("Enabled")
.HasColumnType("INTEGER")
.HasColumnName("enabled");
b.Property<short>("FailedImportMaxStrikes")
.HasColumnType("INTEGER")
.HasColumnName("failed_import_max_strikes");
b.HasKey("Id")
.HasName("pk_radarr_configs");
b.ToTable("radarr_configs", (string)null);
});
modelBuilder.Entity("Common.Configuration.Arr.SonarrConfig", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT")
.HasColumnName("id");
b.Property<bool>("Enabled")
.HasColumnType("INTEGER")
.HasColumnName("enabled");
b.Property<short>("FailedImportMaxStrikes")
.HasColumnType("INTEGER")
.HasColumnName("failed_import_max_strikes");
b.Property<string>("SearchType")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("search_type");
b.HasKey("Id")
.HasName("pk_sonarr_configs");
b.ToTable("sonarr_configs", (string)null);
});
modelBuilder.Entity("Common.Configuration.DownloadCleaner.CleanCategory", b =>
modelBuilder.Entity("Data.Models.Configuration.DownloadCleaner.CleanCategory", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
@@ -175,7 +167,7 @@ namespace Data.Migrations.Data
b.ToTable("clean_category", (string)null);
});
modelBuilder.Entity("Common.Configuration.DownloadCleaner.DownloadCleanerConfig", b =>
modelBuilder.Entity("Data.Models.Configuration.DownloadCleaner.DownloadCleanerConfig", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
@@ -228,55 +220,7 @@ namespace Data.Migrations.Data
b.ToTable("download_cleaner_configs", (string)null);
});
modelBuilder.Entity("Common.Configuration.DownloadClientConfig", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT")
.HasColumnName("id");
b.Property<bool>("Enabled")
.HasColumnType("INTEGER")
.HasColumnName("enabled");
b.Property<string>("Host")
.HasColumnType("TEXT")
.HasColumnName("host");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("name");
b.Property<string>("Password")
.HasColumnType("TEXT")
.HasColumnName("password");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("type");
b.Property<string>("TypeName")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("type_name");
b.Property<string>("UrlBase")
.HasColumnType("TEXT")
.HasColumnName("url_base");
b.Property<string>("Username")
.HasColumnType("TEXT")
.HasColumnName("username");
b.HasKey("Id")
.HasName("pk_download_clients");
b.ToTable("download_clients", (string)null);
});
modelBuilder.Entity("Common.Configuration.General.GeneralConfig", b =>
modelBuilder.Entity("Data.Models.Configuration.General.GeneralConfig", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
@@ -329,7 +273,7 @@ namespace Data.Migrations.Data
b.ToTable("general_configs", (string)null);
});
modelBuilder.Entity("Common.Configuration.Notification.AppriseConfig", b =>
modelBuilder.Entity("Data.Models.Configuration.Notification.AppriseConfig", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
@@ -374,7 +318,7 @@ namespace Data.Migrations.Data
b.ToTable("apprise_configs", (string)null);
});
modelBuilder.Entity("Common.Configuration.Notification.NotifiarrConfig", b =>
modelBuilder.Entity("Data.Models.Configuration.Notification.NotifiarrConfig", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
@@ -419,7 +363,7 @@ namespace Data.Migrations.Data
b.ToTable("notifiarr_configs", (string)null);
});
modelBuilder.Entity("Common.Configuration.QueueCleaner.QueueCleanerConfig", b =>
modelBuilder.Entity("Data.Models.Configuration.QueueCleaner.QueueCleanerConfig", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
@@ -439,7 +383,7 @@ namespace Data.Migrations.Data
.HasColumnType("INTEGER")
.HasColumnName("use_advanced_scheduling");
b.ComplexProperty<Dictionary<string, object>>("ContentBlocker", "Common.Configuration.QueueCleaner.QueueCleanerConfig.ContentBlocker#ContentBlockerConfig", b1 =>
b.ComplexProperty<Dictionary<string, object>>("ContentBlocker", "Data.Models.Configuration.QueueCleaner.QueueCleanerConfig.ContentBlocker#ContentBlockerConfig", b1 =>
{
b1.IsRequired();
@@ -455,7 +399,7 @@ namespace Data.Migrations.Data
.HasColumnType("INTEGER")
.HasColumnName("content_blocker_ignore_private");
b1.ComplexProperty<Dictionary<string, object>>("Lidarr", "Common.Configuration.QueueCleaner.QueueCleanerConfig.ContentBlocker#ContentBlockerConfig.Lidarr#BlocklistSettings", b2 =>
b1.ComplexProperty<Dictionary<string, object>>("Lidarr", "Data.Models.Configuration.QueueCleaner.QueueCleanerConfig.ContentBlocker#ContentBlockerConfig.Lidarr#BlocklistSettings", b2 =>
{
b2.IsRequired();
@@ -468,7 +412,7 @@ namespace Data.Migrations.Data
.HasColumnName("content_blocker_lidarr_blocklist_type");
});
b1.ComplexProperty<Dictionary<string, object>>("Radarr", "Common.Configuration.QueueCleaner.QueueCleanerConfig.ContentBlocker#ContentBlockerConfig.Radarr#BlocklistSettings", b2 =>
b1.ComplexProperty<Dictionary<string, object>>("Radarr", "Data.Models.Configuration.QueueCleaner.QueueCleanerConfig.ContentBlocker#ContentBlockerConfig.Radarr#BlocklistSettings", b2 =>
{
b2.IsRequired();
@@ -481,7 +425,7 @@ namespace Data.Migrations.Data
.HasColumnName("content_blocker_radarr_blocklist_type");
});
b1.ComplexProperty<Dictionary<string, object>>("Sonarr", "Common.Configuration.QueueCleaner.QueueCleanerConfig.ContentBlocker#ContentBlockerConfig.Sonarr#BlocklistSettings", b2 =>
b1.ComplexProperty<Dictionary<string, object>>("Sonarr", "Data.Models.Configuration.QueueCleaner.QueueCleanerConfig.ContentBlocker#ContentBlockerConfig.Sonarr#BlocklistSettings", b2 =>
{
b2.IsRequired();
@@ -495,7 +439,7 @@ namespace Data.Migrations.Data
});
});
b.ComplexProperty<Dictionary<string, object>>("FailedImport", "Common.Configuration.QueueCleaner.QueueCleanerConfig.FailedImport#FailedImportConfig", b1 =>
b.ComplexProperty<Dictionary<string, object>>("FailedImport", "Data.Models.Configuration.QueueCleaner.QueueCleanerConfig.FailedImport#FailedImportConfig", b1 =>
{
b1.IsRequired();
@@ -517,7 +461,7 @@ namespace Data.Migrations.Data
.HasColumnName("failed_import_max_strikes");
});
b.ComplexProperty<Dictionary<string, object>>("Slow", "Common.Configuration.QueueCleaner.QueueCleanerConfig.Slow#SlowConfig", b1 =>
b.ComplexProperty<Dictionary<string, object>>("Slow", "Data.Models.Configuration.QueueCleaner.QueueCleanerConfig.Slow#SlowConfig", b1 =>
{
b1.IsRequired();
@@ -552,7 +496,7 @@ namespace Data.Migrations.Data
.HasColumnName("slow_reset_strikes_on_progress");
});
b.ComplexProperty<Dictionary<string, object>>("Stalled", "Common.Configuration.QueueCleaner.QueueCleanerConfig.Stalled#StalledConfig", b1 =>
b.ComplexProperty<Dictionary<string, object>>("Stalled", "Data.Models.Configuration.QueueCleaner.QueueCleanerConfig.Stalled#StalledConfig", b1 =>
{
b1.IsRequired();
@@ -583,48 +527,32 @@ namespace Data.Migrations.Data
b.ToTable("queue_cleaner_configs", (string)null);
});
modelBuilder.Entity("Common.Configuration.Arr.ArrInstance", b =>
modelBuilder.Entity("Data.Models.Configuration.Arr.ArrInstance", b =>
{
b.HasOne("Common.Configuration.Arr.LidarrConfig", null)
b.HasOne("Data.Models.Configuration.Arr.ArrConfig", "ArrConfig")
.WithMany("Instances")
.HasForeignKey("LidarrConfigId")
.HasConstraintName("fk_arr_instance_lidarr_configs_lidarr_config_id");
.HasForeignKey("ArrConfigId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_arr_instances_arr_configs_arr_config_id");
b.HasOne("Common.Configuration.Arr.RadarrConfig", null)
.WithMany("Instances")
.HasForeignKey("RadarrConfigId")
.HasConstraintName("fk_arr_instance_radarr_configs_radarr_config_id");
b.HasOne("Common.Configuration.Arr.SonarrConfig", null)
.WithMany("Instances")
.HasForeignKey("SonarrConfigId")
.HasConstraintName("fk_arr_instance_sonarr_configs_sonarr_config_id");
b.Navigation("ArrConfig");
});
modelBuilder.Entity("Common.Configuration.DownloadCleaner.CleanCategory", b =>
modelBuilder.Entity("Data.Models.Configuration.DownloadCleaner.CleanCategory", b =>
{
b.HasOne("Common.Configuration.DownloadCleaner.DownloadCleanerConfig", null)
b.HasOne("Data.Models.Configuration.DownloadCleaner.DownloadCleanerConfig", null)
.WithMany("Categories")
.HasForeignKey("DownloadCleanerConfigId")
.HasConstraintName("fk_clean_category_download_cleaner_configs_download_cleaner_config_id");
});
modelBuilder.Entity("Common.Configuration.Arr.LidarrConfig", b =>
modelBuilder.Entity("Data.Models.Configuration.Arr.ArrConfig", b =>
{
b.Navigation("Instances");
});
modelBuilder.Entity("Common.Configuration.Arr.RadarrConfig", b =>
{
b.Navigation("Instances");
});
modelBuilder.Entity("Common.Configuration.Arr.SonarrConfig", b =>
{
b.Navigation("Instances");
});
modelBuilder.Entity("Common.Configuration.DownloadCleaner.DownloadCleanerConfig", b =>
modelBuilder.Entity("Data.Models.Configuration.DownloadCleaner.DownloadCleanerConfig", b =>
{
b.Navigation("Categories");
});

View File

@@ -30,6 +30,20 @@ namespace Data.Migrations.Data
table.PrimaryKey("pk_apprise_configs", x => x.id);
});
migrationBuilder.CreateTable(
name: "arr_configs",
columns: table => new
{
id = table.Column<Guid>(type: "TEXT", nullable: false),
type = table.Column<string>(type: "TEXT", nullable: false),
enabled = table.Column<bool>(type: "INTEGER", nullable: false),
failed_import_max_strikes = table.Column<short>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("pk_arr_configs", x => x.id);
});
migrationBuilder.CreateTable(
name: "download_cleaner_configs",
columns: table => new
@@ -89,19 +103,6 @@ namespace Data.Migrations.Data
table.PrimaryKey("pk_general_configs", x => x.id);
});
migrationBuilder.CreateTable(
name: "lidarr_configs",
columns: table => new
{
id = table.Column<Guid>(type: "TEXT", nullable: false),
enabled = table.Column<bool>(type: "INTEGER", nullable: false),
failed_import_max_strikes = table.Column<short>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("pk_lidarr_configs", x => x.id);
});
migrationBuilder.CreateTable(
name: "notifiarr_configs",
columns: table => new
@@ -161,30 +162,24 @@ namespace Data.Migrations.Data
});
migrationBuilder.CreateTable(
name: "radarr_configs",
name: "arr_instances",
columns: table => new
{
id = table.Column<Guid>(type: "TEXT", nullable: false),
enabled = table.Column<bool>(type: "INTEGER", nullable: false),
failed_import_max_strikes = table.Column<short>(type: "INTEGER", nullable: false)
arr_config_id = table.Column<Guid>(type: "TEXT", nullable: false),
name = table.Column<string>(type: "TEXT", nullable: false),
url = table.Column<string>(type: "TEXT", nullable: false),
api_key = table.Column<string>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("pk_radarr_configs", x => x.id);
});
migrationBuilder.CreateTable(
name: "sonarr_configs",
columns: table => new
{
id = table.Column<Guid>(type: "TEXT", nullable: false),
search_type = table.Column<string>(type: "TEXT", nullable: false),
enabled = table.Column<bool>(type: "INTEGER", nullable: false),
failed_import_max_strikes = table.Column<short>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("pk_sonarr_configs", x => x.id);
table.PrimaryKey("pk_arr_instances", x => x.id);
table.ForeignKey(
name: "fk_arr_instances_arr_configs_arr_config_id",
column: x => x.arr_config_id,
principalTable: "arr_configs",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
@@ -208,63 +203,6 @@ namespace Data.Migrations.Data
principalColumn: "id");
});
migrationBuilder.CreateTable(
name: "arr_instance",
columns: table => new
{
id = table.Column<Guid>(type: "TEXT", nullable: false),
name = table.Column<string>(type: "TEXT", nullable: false),
url = table.Column<string>(type: "TEXT", nullable: false),
api_key = table.Column<string>(type: "TEXT", nullable: false),
lidarr_config_id = table.Column<Guid>(type: "TEXT", nullable: true),
radarr_config_id = table.Column<Guid>(type: "TEXT", nullable: true),
sonarr_config_id = table.Column<Guid>(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("pk_arr_instance", x => x.id);
table.ForeignKey(
name: "fk_arr_instance_lidarr_configs_lidarr_config_id",
column: x => x.lidarr_config_id,
principalTable: "lidarr_configs",
principalColumn: "id");
table.ForeignKey(
name: "fk_arr_instance_radarr_configs_radarr_config_id",
column: x => x.radarr_config_id,
principalTable: "radarr_configs",
principalColumn: "id");
table.ForeignKey(
name: "fk_arr_instance_sonarr_configs_sonarr_config_id",
column: x => x.sonarr_config_id,
principalTable: "sonarr_configs",
principalColumn: "id");
});
migrationBuilder.CreateIndex(
name: "ix_arr_instance_lidarr_config_id",
table: "arr_instance",
column: "lidarr_config_id");
migrationBuilder.CreateIndex(
name: "ix_arr_instance_radarr_config_id",
table: "arr_instance",
column: "radarr_config_id");
migrationBuilder.CreateIndex(
name: "ix_arr_instance_sonarr_config_id",
table: "arr_instance",
column: "sonarr_config_id");
migrationBuilder.CreateIndex(
name: "ix_clean_category_download_cleaner_config_id",
table: "clean_category",
column: "download_cleaner_config_id");
migrationBuilder.InsertData(
table: "apprise_configs",
columns: new[] { "id", "key", "on_category_changed", "on_download_cleaned", "on_failed_import_strike", "on_queue_item_deleted", "on_slow_strike", "on_stalled_strike", "url" },
values: new object[] { new Guid("9c7a346a-2b80-4935-ae4f-5400e336fd07"), null, false, false, false, false, false, false, null });
migrationBuilder.InsertData(
table: "queue_cleaner_configs",
columns: new[]
@@ -342,25 +280,40 @@ namespace Data.Migrations.Data
columns: new[] { "id", "dry_run", "encryption_key", "http_certificate_validation", "http_max_retries", "http_timeout", "ignored_downloads", "log_level", "search_delay", "search_enabled" },
values: new object[] { new Guid("1490f450-1b29-4111-ab20-8a03dbd9d366"), false, "00253fe9-6c9b-4b0e-a05e-e5d2164f2389", "Enabled", (ushort)0, (ushort)100, "[]", "Information", (ushort)30, true });
migrationBuilder.InsertData(
table: "lidarr_configs",
columns: new[] { "id", "enabled", "failed_import_max_strikes" },
values: new object[] { new Guid("6096303a-399c-42b8-be8f-60a02cec5a51"), false, (short)-1 });
migrationBuilder.InsertData(
table: "notifiarr_configs",
columns: new[] { "id", "api_key", "channel_id", "on_category_changed", "on_download_cleaned", "on_failed_import_strike", "on_queue_item_deleted", "on_slow_strike", "on_stalled_strike" },
values: new object[] { new Guid("dd468589-e5ee-4e1b-b05e-28b461894846"), null, null, false, false, false, false, false, false });
migrationBuilder.InsertData(
table: "radarr_configs",
columns: new[] { "id", "enabled", "failed_import_max_strikes" },
values: new object[] { new Guid("4fd2b82b-cffd-4b41-bcc0-204058b1e459"), false, (short)-1 });
table: "apprise_configs",
columns: new[] { "id", "key", "on_category_changed", "on_download_cleaned", "on_failed_import_strike", "on_queue_item_deleted", "on_slow_strike", "on_stalled_strike", "url" },
values: new object[] { new Guid("9c7a346a-2b80-4935-ae4f-5400e336fd07"), null, false, false, false, false, false, false, null });
migrationBuilder.InsertData(
table: "arr_configs",
columns: new[] { "id", "enabled", "failed_import_max_strikes", "type" },
values: new object[] { new Guid("6096303a-399c-42b8-be8f-60a02cec5a51"), false, (short)-1, "radarr" });
migrationBuilder.InsertData(
table: "arr_configs",
columns: new[] { "id", "enabled", "failed_import_max_strikes", "type" },
values: new object[] { new Guid("4fd2b82b-cffd-4b41-bcc0-204058b1e459"), false, (short)-1, "lidarr" });
migrationBuilder.InsertData(
table: "sonarr_configs",
columns: new[] { "id", "enabled", "failed_import_max_strikes", "search_type" },
values: new object[] { new Guid("0b38a68f-3d7b-4d98-ae96-115da62d9af2"), false, (short)-1, "Episode" });
table: "arr_configs",
columns: new[] { "id", "enabled", "failed_import_max_strikes", "type" },
values: new object[] { new Guid("0b38a68f-3d7b-4d98-ae96-115da62d9af2"), false, (short)-1, "sonarr" });
migrationBuilder.CreateIndex(
name: "ix_arr_instances_arr_config_id",
table: "arr_instances",
column: "arr_config_id");
migrationBuilder.CreateIndex(
name: "ix_clean_category_download_cleaner_config_id",
table: "clean_category",
column: "download_cleaner_config_id");
}
/// <inheritdoc />
@@ -370,7 +323,7 @@ namespace Data.Migrations.Data
name: "apprise_configs");
migrationBuilder.DropTable(
name: "arr_instance");
name: "arr_instances");
migrationBuilder.DropTable(
name: "clean_category");
@@ -388,13 +341,7 @@ namespace Data.Migrations.Data
name: "queue_cleaner_configs");
migrationBuilder.DropTable(
name: "lidarr_configs");
migrationBuilder.DropTable(
name: "radarr_configs");
migrationBuilder.DropTable(
name: "sonarr_configs");
name: "arr_configs");
migrationBuilder.DropTable(
name: "download_cleaner_configs");

View File

@@ -18,7 +18,81 @@ namespace Data.Migrations.Data
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "9.0.5");
modelBuilder.Entity("Common.Configuration.Arr.ArrInstance", b =>
modelBuilder.Entity("Common.Configuration.DownloadClientConfig", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT")
.HasColumnName("id");
b.Property<bool>("Enabled")
.HasColumnType("INTEGER")
.HasColumnName("enabled");
b.Property<string>("Host")
.HasColumnType("TEXT")
.HasColumnName("host");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("name");
b.Property<string>("Password")
.HasColumnType("TEXT")
.HasColumnName("password");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("type");
b.Property<string>("TypeName")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("type_name");
b.Property<string>("UrlBase")
.HasColumnType("TEXT")
.HasColumnName("url_base");
b.Property<string>("Username")
.HasColumnType("TEXT")
.HasColumnName("username");
b.HasKey("Id")
.HasName("pk_download_clients");
b.ToTable("download_clients", (string)null);
});
modelBuilder.Entity("Data.Models.Configuration.Arr.ArrConfig", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT")
.HasColumnName("id");
b.Property<bool>("Enabled")
.HasColumnType("INTEGER")
.HasColumnName("enabled");
b.Property<short>("FailedImportMaxStrikes")
.HasColumnType("INTEGER")
.HasColumnName("failed_import_max_strikes");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("type");
b.HasKey("Id")
.HasName("pk_arr_configs");
b.ToTable("arr_configs", (string)null);
});
modelBuilder.Entity("Data.Models.Configuration.Arr.ArrInstance", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
@@ -30,112 +104,30 @@ namespace Data.Migrations.Data
.HasColumnType("TEXT")
.HasColumnName("api_key");
b.Property<Guid?>("LidarrConfigId")
b.Property<Guid>("ArrConfigId")
.HasColumnType("TEXT")
.HasColumnName("lidarr_config_id");
.HasColumnName("arr_config_id");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("name");
b.Property<Guid?>("RadarrConfigId")
.HasColumnType("TEXT")
.HasColumnName("radarr_config_id");
b.Property<Guid?>("SonarrConfigId")
.HasColumnType("TEXT")
.HasColumnName("sonarr_config_id");
b.Property<string>("Url")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("url");
b.HasKey("Id")
.HasName("pk_arr_instance");
.HasName("pk_arr_instances");
b.HasIndex("LidarrConfigId")
.HasDatabaseName("ix_arr_instance_lidarr_config_id");
b.HasIndex("ArrConfigId")
.HasDatabaseName("ix_arr_instances_arr_config_id");
b.HasIndex("RadarrConfigId")
.HasDatabaseName("ix_arr_instance_radarr_config_id");
b.HasIndex("SonarrConfigId")
.HasDatabaseName("ix_arr_instance_sonarr_config_id");
b.ToTable("arr_instance", (string)null);
b.ToTable("arr_instances", (string)null);
});
modelBuilder.Entity("Common.Configuration.Arr.LidarrConfig", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT")
.HasColumnName("id");
b.Property<bool>("Enabled")
.HasColumnType("INTEGER")
.HasColumnName("enabled");
b.Property<short>("FailedImportMaxStrikes")
.HasColumnType("INTEGER")
.HasColumnName("failed_import_max_strikes");
b.HasKey("Id")
.HasName("pk_lidarr_configs");
b.ToTable("lidarr_configs", (string)null);
});
modelBuilder.Entity("Common.Configuration.Arr.RadarrConfig", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT")
.HasColumnName("id");
b.Property<bool>("Enabled")
.HasColumnType("INTEGER")
.HasColumnName("enabled");
b.Property<short>("FailedImportMaxStrikes")
.HasColumnType("INTEGER")
.HasColumnName("failed_import_max_strikes");
b.HasKey("Id")
.HasName("pk_radarr_configs");
b.ToTable("radarr_configs", (string)null);
});
modelBuilder.Entity("Common.Configuration.Arr.SonarrConfig", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT")
.HasColumnName("id");
b.Property<bool>("Enabled")
.HasColumnType("INTEGER")
.HasColumnName("enabled");
b.Property<short>("FailedImportMaxStrikes")
.HasColumnType("INTEGER")
.HasColumnName("failed_import_max_strikes");
b.Property<string>("SearchType")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("search_type");
b.HasKey("Id")
.HasName("pk_sonarr_configs");
b.ToTable("sonarr_configs", (string)null);
});
modelBuilder.Entity("Common.Configuration.DownloadCleaner.CleanCategory", b =>
modelBuilder.Entity("Data.Models.Configuration.DownloadCleaner.CleanCategory", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
@@ -172,7 +164,7 @@ namespace Data.Migrations.Data
b.ToTable("clean_category", (string)null);
});
modelBuilder.Entity("Common.Configuration.DownloadCleaner.DownloadCleanerConfig", b =>
modelBuilder.Entity("Data.Models.Configuration.DownloadCleaner.DownloadCleanerConfig", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
@@ -225,55 +217,7 @@ namespace Data.Migrations.Data
b.ToTable("download_cleaner_configs", (string)null);
});
modelBuilder.Entity("Common.Configuration.DownloadClientConfig", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT")
.HasColumnName("id");
b.Property<bool>("Enabled")
.HasColumnType("INTEGER")
.HasColumnName("enabled");
b.Property<string>("Host")
.HasColumnType("TEXT")
.HasColumnName("host");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("name");
b.Property<string>("Password")
.HasColumnType("TEXT")
.HasColumnName("password");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("type");
b.Property<string>("TypeName")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("type_name");
b.Property<string>("UrlBase")
.HasColumnType("TEXT")
.HasColumnName("url_base");
b.Property<string>("Username")
.HasColumnType("TEXT")
.HasColumnName("username");
b.HasKey("Id")
.HasName("pk_download_clients");
b.ToTable("download_clients", (string)null);
});
modelBuilder.Entity("Common.Configuration.General.GeneralConfig", b =>
modelBuilder.Entity("Data.Models.Configuration.General.GeneralConfig", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
@@ -326,7 +270,7 @@ namespace Data.Migrations.Data
b.ToTable("general_configs", (string)null);
});
modelBuilder.Entity("Common.Configuration.Notification.AppriseConfig", b =>
modelBuilder.Entity("Data.Models.Configuration.Notification.AppriseConfig", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
@@ -371,7 +315,7 @@ namespace Data.Migrations.Data
b.ToTable("apprise_configs", (string)null);
});
modelBuilder.Entity("Common.Configuration.Notification.NotifiarrConfig", b =>
modelBuilder.Entity("Data.Models.Configuration.Notification.NotifiarrConfig", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
@@ -416,7 +360,7 @@ namespace Data.Migrations.Data
b.ToTable("notifiarr_configs", (string)null);
});
modelBuilder.Entity("Common.Configuration.QueueCleaner.QueueCleanerConfig", b =>
modelBuilder.Entity("Data.Models.Configuration.QueueCleaner.QueueCleanerConfig", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
@@ -436,7 +380,7 @@ namespace Data.Migrations.Data
.HasColumnType("INTEGER")
.HasColumnName("use_advanced_scheduling");
b.ComplexProperty<Dictionary<string, object>>("ContentBlocker", "Common.Configuration.QueueCleaner.QueueCleanerConfig.ContentBlocker#ContentBlockerConfig", b1 =>
b.ComplexProperty<Dictionary<string, object>>("ContentBlocker", "Data.Models.Configuration.QueueCleaner.QueueCleanerConfig.ContentBlocker#ContentBlockerConfig", b1 =>
{
b1.IsRequired();
@@ -452,7 +396,7 @@ namespace Data.Migrations.Data
.HasColumnType("INTEGER")
.HasColumnName("content_blocker_ignore_private");
b1.ComplexProperty<Dictionary<string, object>>("Lidarr", "Common.Configuration.QueueCleaner.QueueCleanerConfig.ContentBlocker#ContentBlockerConfig.Lidarr#BlocklistSettings", b2 =>
b1.ComplexProperty<Dictionary<string, object>>("Lidarr", "Data.Models.Configuration.QueueCleaner.QueueCleanerConfig.ContentBlocker#ContentBlockerConfig.Lidarr#BlocklistSettings", b2 =>
{
b2.IsRequired();
@@ -465,7 +409,7 @@ namespace Data.Migrations.Data
.HasColumnName("content_blocker_lidarr_blocklist_type");
});
b1.ComplexProperty<Dictionary<string, object>>("Radarr", "Common.Configuration.QueueCleaner.QueueCleanerConfig.ContentBlocker#ContentBlockerConfig.Radarr#BlocklistSettings", b2 =>
b1.ComplexProperty<Dictionary<string, object>>("Radarr", "Data.Models.Configuration.QueueCleaner.QueueCleanerConfig.ContentBlocker#ContentBlockerConfig.Radarr#BlocklistSettings", b2 =>
{
b2.IsRequired();
@@ -478,7 +422,7 @@ namespace Data.Migrations.Data
.HasColumnName("content_blocker_radarr_blocklist_type");
});
b1.ComplexProperty<Dictionary<string, object>>("Sonarr", "Common.Configuration.QueueCleaner.QueueCleanerConfig.ContentBlocker#ContentBlockerConfig.Sonarr#BlocklistSettings", b2 =>
b1.ComplexProperty<Dictionary<string, object>>("Sonarr", "Data.Models.Configuration.QueueCleaner.QueueCleanerConfig.ContentBlocker#ContentBlockerConfig.Sonarr#BlocklistSettings", b2 =>
{
b2.IsRequired();
@@ -492,7 +436,7 @@ namespace Data.Migrations.Data
});
});
b.ComplexProperty<Dictionary<string, object>>("FailedImport", "Common.Configuration.QueueCleaner.QueueCleanerConfig.FailedImport#FailedImportConfig", b1 =>
b.ComplexProperty<Dictionary<string, object>>("FailedImport", "Data.Models.Configuration.QueueCleaner.QueueCleanerConfig.FailedImport#FailedImportConfig", b1 =>
{
b1.IsRequired();
@@ -514,7 +458,7 @@ namespace Data.Migrations.Data
.HasColumnName("failed_import_max_strikes");
});
b.ComplexProperty<Dictionary<string, object>>("Slow", "Common.Configuration.QueueCleaner.QueueCleanerConfig.Slow#SlowConfig", b1 =>
b.ComplexProperty<Dictionary<string, object>>("Slow", "Data.Models.Configuration.QueueCleaner.QueueCleanerConfig.Slow#SlowConfig", b1 =>
{
b1.IsRequired();
@@ -549,7 +493,7 @@ namespace Data.Migrations.Data
.HasColumnName("slow_reset_strikes_on_progress");
});
b.ComplexProperty<Dictionary<string, object>>("Stalled", "Common.Configuration.QueueCleaner.QueueCleanerConfig.Stalled#StalledConfig", b1 =>
b.ComplexProperty<Dictionary<string, object>>("Stalled", "Data.Models.Configuration.QueueCleaner.QueueCleanerConfig.Stalled#StalledConfig", b1 =>
{
b1.IsRequired();
@@ -580,48 +524,32 @@ namespace Data.Migrations.Data
b.ToTable("queue_cleaner_configs", (string)null);
});
modelBuilder.Entity("Common.Configuration.Arr.ArrInstance", b =>
modelBuilder.Entity("Data.Models.Configuration.Arr.ArrInstance", b =>
{
b.HasOne("Common.Configuration.Arr.LidarrConfig", null)
b.HasOne("Data.Models.Configuration.Arr.ArrConfig", "ArrConfig")
.WithMany("Instances")
.HasForeignKey("LidarrConfigId")
.HasConstraintName("fk_arr_instance_lidarr_configs_lidarr_config_id");
.HasForeignKey("ArrConfigId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_arr_instances_arr_configs_arr_config_id");
b.HasOne("Common.Configuration.Arr.RadarrConfig", null)
.WithMany("Instances")
.HasForeignKey("RadarrConfigId")
.HasConstraintName("fk_arr_instance_radarr_configs_radarr_config_id");
b.HasOne("Common.Configuration.Arr.SonarrConfig", null)
.WithMany("Instances")
.HasForeignKey("SonarrConfigId")
.HasConstraintName("fk_arr_instance_sonarr_configs_sonarr_config_id");
b.Navigation("ArrConfig");
});
modelBuilder.Entity("Common.Configuration.DownloadCleaner.CleanCategory", b =>
modelBuilder.Entity("Data.Models.Configuration.DownloadCleaner.CleanCategory", b =>
{
b.HasOne("Common.Configuration.DownloadCleaner.DownloadCleanerConfig", null)
b.HasOne("Data.Models.Configuration.DownloadCleaner.DownloadCleanerConfig", null)
.WithMany("Categories")
.HasForeignKey("DownloadCleanerConfigId")
.HasConstraintName("fk_clean_category_download_cleaner_configs_download_cleaner_config_id");
});
modelBuilder.Entity("Common.Configuration.Arr.LidarrConfig", b =>
modelBuilder.Entity("Data.Models.Configuration.Arr.ArrConfig", b =>
{
b.Navigation("Instances");
});
modelBuilder.Entity("Common.Configuration.Arr.RadarrConfig", b =>
{
b.Navigation("Instances");
});
modelBuilder.Entity("Common.Configuration.Arr.SonarrConfig", b =>
{
b.Navigation("Instances");
});
modelBuilder.Entity("Common.Configuration.DownloadCleaner.DownloadCleanerConfig", b =>
modelBuilder.Entity("Data.Models.Configuration.DownloadCleaner.DownloadCleanerConfig", b =>
{
b.Navigation("Categories");
});

View File

@@ -1,4 +1,4 @@
using Common.Configuration.Arr;
using Data.Models.Configuration.Arr;
namespace Data.Models.Arr;

View File

@@ -1,19 +1,25 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Common.Configuration;
using Data.Enums;
namespace Common.Configuration.Arr;
namespace Data.Models.Configuration.Arr;
public abstract class ArrConfig : IConfig
public class ArrConfig : IConfig
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public Guid Id { get; set; } = Guid.NewGuid();
public required InstanceType Type { get; set; }
public bool Enabled { get; set; }
public short FailedImportMaxStrikes { get; set; } = -1;
public List<ArrInstance> Instances { get; set; } = [];
public abstract void Validate();
public void Validate()
{
}
}

View File

@@ -2,7 +2,7 @@
using System.ComponentModel.DataAnnotations.Schema;
using Common.Attributes;
namespace Common.Configuration.Arr;
namespace Data.Models.Configuration.Arr;
public sealed class ArrInstance
{
@@ -10,6 +10,10 @@ public sealed class ArrInstance
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public Guid Id { get; set; } = Guid.NewGuid();
public Guid ArrConfigId { get; set; }
public ArrConfig ArrConfig { get; set; }
public required string Name { get; set; }
public required Uri Url { get; set; }

View File

@@ -1,4 +1,4 @@
namespace Common.Configuration.Arr;
namespace Data.Models.Configuration.Arr;
public enum SonarrSearchType
{

View File

@@ -1,8 +1,9 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Common.Configuration;
using ValidationException = Common.Exceptions.ValidationException;
namespace Common.Configuration.DownloadCleaner;
namespace Data.Models.Configuration.DownloadCleaner;
public sealed record CleanCategory : IConfig
{

View File

@@ -1,8 +1,9 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Common.Configuration;
using ValidationException = Common.Exceptions.ValidationException;
namespace Common.Configuration.DownloadCleaner;
namespace Data.Models.Configuration.DownloadCleaner;
public sealed record DownloadCleanerConfig : IJobConfig
{

View File

@@ -1,10 +1,11 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Common.Configuration;
using Common.Enums;
using Serilog.Events;
using ValidationException = Common.Exceptions.ValidationException;
namespace Common.Configuration.General;
namespace Data.Models.Configuration.General;
public sealed record GeneralConfig : IConfig
{

View File

@@ -1,4 +1,4 @@
namespace Common.Configuration.Notification;
namespace Data.Models.Configuration.Notification;
public sealed record AppriseConfig : NotificationConfig
{

View File

@@ -1,4 +1,4 @@
namespace Common.Configuration.Notification;
namespace Data.Models.Configuration.Notification;
public sealed record NotifiarrConfig : NotificationConfig
{

View File

@@ -1,7 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Common.Configuration.Notification;
namespace Data.Models.Configuration.Notification;
public abstract record NotificationConfig
{

View File

@@ -1,6 +1,6 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace Common.Configuration.QueueCleaner;
namespace Data.Models.Configuration.QueueCleaner;
/// <summary>
/// Settings for a blocklist

View File

@@ -1,4 +1,4 @@
namespace Common.Configuration.QueueCleaner;
namespace Data.Models.Configuration.QueueCleaner;
public enum BlocklistType
{

View File

@@ -1,6 +1,6 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace Common.Configuration.QueueCleaner;
namespace Data.Models.Configuration.QueueCleaner;
[ComplexType]
public sealed record ContentBlockerConfig

View File

@@ -1,7 +1,7 @@
using System.ComponentModel.DataAnnotations.Schema;
using Common.Exceptions;
namespace Common.Configuration.QueueCleaner;
namespace Data.Models.Configuration.QueueCleaner;
[ComplexType]
public sealed record FailedImportConfig

View File

@@ -1,7 +1,8 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Common.Configuration;
namespace Common.Configuration.QueueCleaner;
namespace Data.Models.Configuration.QueueCleaner;
public sealed record QueueCleanerConfig : IJobConfig
{

View File

@@ -3,7 +3,7 @@ using System.Text.Json.Serialization;
using Common.CustomDataTypes;
using Common.Exceptions;
namespace Common.Configuration.QueueCleaner;
namespace Data.Models.Configuration.QueueCleaner;
[ComplexType]
public sealed record SlowConfig

View File

@@ -1,7 +1,7 @@
using System.ComponentModel.DataAnnotations.Schema;
using Common.Exceptions;
namespace Common.Configuration.QueueCleaner;
namespace Data.Models.Configuration.QueueCleaner;
[ComplexType]
public sealed record StalledConfig

View File

@@ -1,4 +1,4 @@
using Common.Configuration.Arr;
using Data.Models.Configuration.Arr;
namespace Data.Models.Sonarr;

View File

@@ -1,17 +1,16 @@
using Common.Configuration;
using Common.Configuration.Arr;
using Common.Configuration.DownloadCleaner;
using Common.Configuration.General;
using Common.Configuration.QueueCleaner;
using Data.Models.Configuration.Arr;
using Data.Models.Configuration.DownloadCleaner;
using Data.Models.Configuration.General;
using Data.Models.Configuration.QueueCleaner;
using Data;
using Data.Enums;
using Infrastructure.Logging;
using Infrastructure.Models;
using Infrastructure.Services.Interfaces;
using Infrastructure.Verticals.ContentBlocker;
using Mapster;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using System;
using Executable.DTOs;
namespace Executable.Controllers;
@@ -228,9 +227,9 @@ public class ConfigurationController : ControllerBase
await DataContext.Lock.WaitAsync();
try
{
var config = await _dataContext.SonarrConfigs
var config = await _dataContext.ArrConfigs
.AsNoTracking()
.FirstAsync();
.FirstAsync(x => x.Type == InstanceType.Sonarr);
return Ok(config);
}
finally
@@ -245,9 +244,9 @@ public class ConfigurationController : ControllerBase
await DataContext.Lock.WaitAsync();
try
{
var config = await _dataContext.RadarrConfigs
var config = await _dataContext.ArrConfigs
.AsNoTracking()
.FirstAsync();
.FirstAsync(x => x.Type == InstanceType.Radarr);
return Ok(config);
}
finally
@@ -262,9 +261,9 @@ public class ConfigurationController : ControllerBase
await DataContext.Lock.WaitAsync();
try
{
var config = await _dataContext.LidarrConfigs
var config = await _dataContext.ArrConfigs
.AsNoTracking()
.FirstAsync();
.FirstAsync(x => x.Type == InstanceType.Lidarr);
return Ok(config);
}
finally
@@ -417,8 +416,8 @@ public class ConfigurationController : ControllerBase
try
{
// Get existing config
var config = await _dataContext.SonarrConfigs
.FirstAsync();
var config = await _dataContext.ArrConfigs
.FirstAsync(x => x.Type == InstanceType.Sonarr);
config.Enabled = newConfigDto.Enabled;
config.FailedImportMaxStrikes = newConfigDto.FailedImportMaxStrikes;
@@ -449,29 +448,29 @@ public class ConfigurationController : ControllerBase
try
{
// Get existing config
var oldConfig = await _dataContext.RadarrConfigs
var oldConfig = await _dataContext.ArrConfigs
.Include(x => x.Instances)
.FirstAsync();
.FirstAsync(x => x.Type == InstanceType.Radarr);
// Create new config with updated basic settings only (instances managed separately)
var updatedConfig = new RadarrConfig
{
Id = oldConfig.Id, // Keep the existing ID
Enabled = newConfigDto.Enabled,
FailedImportMaxStrikes = newConfigDto.FailedImportMaxStrikes,
Instances = oldConfig.Instances // Keep existing instances unchanged
};
// Validate the configuration
updatedConfig.Validate();
// Update the existing entity using Mapster, excluding the ID
var config = new TypeAdapterConfig();
config.NewConfig<RadarrConfig, RadarrConfig>()
.Ignore(dest => dest.Id)
.Ignore(dest => dest.Instances); // Don't update instances here
updatedConfig.Adapt(oldConfig, config);
// var updatedConfig = new ArrConfig
// {
// Id = oldConfig.Id, // Keep the existing ID
// Enabled = newConfigDto.Enabled,
// FailedImportMaxStrikes = newConfigDto.FailedImportMaxStrikes,
// Instances = oldConfig.Instances // Keep existing instances unchanged
// };
//
// // Validate the configuration
// updatedConfig.Validate();
//
// // Update the existing entity using Mapster, excluding the ID
// var config = new TypeAdapterConfig();
// config.NewConfig<RadarrConfig, RadarrConfig>()
// .Ignore(dest => dest.Id)
// .Ignore(dest => dest.Instances); // Don't update instances here
//
// updatedConfig.Adapt(oldConfig, config);
// Persist the configuration
await _dataContext.SaveChangesAsync();
@@ -496,29 +495,29 @@ public class ConfigurationController : ControllerBase
try
{
// Get existing config
var oldConfig = await _dataContext.LidarrConfigs
.Include(x => x.Instances)
.FirstAsync();
// Create new config with updated basic settings only (instances managed separately)
var updatedConfig = new LidarrConfig
{
Id = oldConfig.Id, // Keep the existing ID
Enabled = newConfigDto.Enabled,
FailedImportMaxStrikes = newConfigDto.FailedImportMaxStrikes,
Instances = oldConfig.Instances // Keep existing instances unchanged
};
// Validate the configuration
updatedConfig.Validate();
// Update the existing entity using Mapster, excluding the ID
var config = new TypeAdapterConfig();
config.NewConfig<LidarrConfig, LidarrConfig>()
.Ignore(dest => dest.Id)
.Ignore(dest => dest.Instances); // Don't update instances here
updatedConfig.Adapt(oldConfig, config);
// var oldConfig = await _dataContext.LidarrConfigs
// .Include(x => x.Instances)
// .FirstAsync();
//
// // Create new config with updated basic settings only (instances managed separately)
// var updatedConfig = new LidarrConfig
// {
// Id = oldConfig.Id, // Keep the existing ID
// Enabled = newConfigDto.Enabled,
// FailedImportMaxStrikes = newConfigDto.FailedImportMaxStrikes,
// Instances = oldConfig.Instances // Keep existing instances unchanged
// };
//
// // Validate the configuration
// updatedConfig.Validate();
//
// // Update the existing entity using Mapster, excluding the ID
// var config = new TypeAdapterConfig();
// config.NewConfig<LidarrConfig, LidarrConfig>()
// .Ignore(dest => dest.Id)
// .Ignore(dest => dest.Instances); // Don't update instances here
//
// updatedConfig.Adapt(oldConfig, config);
// Persist the configuration
await _dataContext.SaveChangesAsync();
@@ -577,9 +576,9 @@ public class ConfigurationController : ControllerBase
try
{
// Get the Sonarr config to add the instance to
var config = await _dataContext.SonarrConfigs
var config = await _dataContext.ArrConfigs
.Include(c => c.Instances)
.FirstAsync();
.FirstAsync(x => x.Type == InstanceType.Sonarr);
// Create the new instance
var instance = new ArrInstance
@@ -590,8 +589,7 @@ public class ConfigurationController : ControllerBase
};
// Add to the config
// config.Instances.Add(instance);
_dataContext.ArrInstances.Add(instance);
config.Instances.Add(instance);
await _dataContext.SaveChangesAsync();
return CreatedAtAction(nameof(GetSonarrConfig), new { id = instance.Id }, instance);
@@ -614,9 +612,9 @@ public class ConfigurationController : ControllerBase
try
{
// Get the Sonarr config and find the instance
var config = await _dataContext.SonarrConfigs
var config = await _dataContext.ArrConfigs
.Include(c => c.Instances)
.FirstAsync();
.FirstAsync(x => x.Type == InstanceType.Sonarr);
var instance = config.Instances.FirstOrDefault(i => i.Id == id);
if (instance == null)
@@ -651,9 +649,9 @@ public class ConfigurationController : ControllerBase
try
{
// Get the Sonarr config and find the instance
var config = await _dataContext.SonarrConfigs
var config = await _dataContext.ArrConfigs
.Include(c => c.Instances)
.FirstAsync();
.FirstAsync(x => x.Type == InstanceType.Sonarr);
var instance = config.Instances.FirstOrDefault(i => i.Id == id);
if (instance == null)
@@ -685,10 +683,10 @@ public class ConfigurationController : ControllerBase
try
{
// Get the Radarr config to add the instance to
var config = await _dataContext.RadarrConfigs
var config = await _dataContext.ArrConfigs
.Include(c => c.Instances)
.FirstAsync();
.FirstAsync(x => x.Type == InstanceType.Radarr);
// Create the new instance
var instance = new ArrInstance
{
@@ -696,7 +694,7 @@ public class ConfigurationController : ControllerBase
Url = new Uri(newInstance.Url),
ApiKey = newInstance.ApiKey
};
// Add to the config
config.Instances.Add(instance);
await _dataContext.SaveChangesAsync();
@@ -721,23 +719,23 @@ public class ConfigurationController : ControllerBase
try
{
// Get the Radarr config and find the instance
var config = await _dataContext.RadarrConfigs
var config = await _dataContext.ArrConfigs
.Include(c => c.Instances)
.FirstAsync();
.FirstAsync(x => x.Type == InstanceType.Radarr);
var instance = config.Instances.FirstOrDefault(i => i.Id == id);
if (instance == null)
{
return NotFound($"Radarr instance with ID {id} not found");
}
// Update the instance properties
instance.Name = updatedInstance.Name;
instance.Url = new Uri(updatedInstance.Url);
instance.ApiKey = updatedInstance.ApiKey;
await _dataContext.SaveChangesAsync();
return Ok(instance);
}
catch (Exception ex)
@@ -758,16 +756,16 @@ public class ConfigurationController : ControllerBase
try
{
// Get the Radarr config and find the instance
var config = await _dataContext.RadarrConfigs
var config = await _dataContext.ArrConfigs
.Include(c => c.Instances)
.FirstAsync();
.FirstAsync(x => x.Type == InstanceType.Radarr);
var instance = config.Instances.FirstOrDefault(i => i.Id == id);
if (instance == null)
{
return NotFound($"Radarr instance with ID {id} not found");
}
// Remove the instance
config.Instances.Remove(instance);
await _dataContext.SaveChangesAsync();
@@ -792,9 +790,9 @@ public class ConfigurationController : ControllerBase
try
{
// Get the Lidarr config to add the instance to
var config = await _dataContext.LidarrConfigs
var config = await _dataContext.ArrConfigs
.Include(c => c.Instances)
.FirstAsync();
.FirstAsync(x => x.Type == InstanceType.Lidarr);
// Create the new instance
var instance = new ArrInstance
@@ -828,9 +826,9 @@ public class ConfigurationController : ControllerBase
try
{
// Get the Lidarr config and find the instance
var config = await _dataContext.LidarrConfigs
var config = await _dataContext.ArrConfigs
.Include(c => c.Instances)
.FirstAsync();
.FirstAsync(x => x.Type == InstanceType.Lidarr);
var instance = config.Instances.FirstOrDefault(i => i.Id == id);
if (instance == null)
@@ -865,9 +863,9 @@ public class ConfigurationController : ControllerBase
try
{
// Get the Lidarr config and find the instance
var config = await _dataContext.LidarrConfigs
var config = await _dataContext.ArrConfigs
.Include(c => c.Instances)
.FirstAsync();
.FirstAsync(x => x.Type == InstanceType.Lidarr);
var instance = config.Instances.FirstOrDefault(i => i.Id == id);
if (instance == null)

View File

@@ -40,18 +40,18 @@ public class StatusController : ControllerBase
var downloadClients = await _dataContext.DownloadClients
.AsNoTracking()
.ToListAsync();
var sonarrConfig = await _dataContext.SonarrConfigs
var sonarrConfig = await _dataContext.ArrConfigs
.Include(x => x.Instances)
.AsNoTracking()
.FirstAsync();
var radarrConfig = await _dataContext.RadarrConfigs
.FirstAsync(x => x.Type == InstanceType.Sonarr);
var radarrConfig = await _dataContext.ArrConfigs
.Include(x => x.Instances)
.AsNoTracking()
.FirstAsync();
var lidarrConfig = await _dataContext.LidarrConfigs
.FirstAsync(x => x.Type == InstanceType.Radarr);
var lidarrConfig = await _dataContext.ArrConfigs
.Include(x => x.Instances)
.AsNoTracking()
.FirstAsync();
.FirstAsync(x => x.Type == InstanceType.Lidarr);
var status = new
{
@@ -143,18 +143,18 @@ public class StatusController : ControllerBase
var status = new Dictionary<string, object>();
// Get configurations
var sonarrConfig = await _dataContext.SonarrConfigs
var sonarrConfig = await _dataContext.ArrConfigs
.Include(x => x.Instances)
.AsNoTracking()
.FirstAsync();
var radarrConfig = await _dataContext.RadarrConfigs
.FirstAsync(x => x.Type == InstanceType.Sonarr);
var radarrConfig = await _dataContext.ArrConfigs
.Include(x => x.Instances)
.AsNoTracking()
.FirstAsync();
var lidarrConfig = await _dataContext.LidarrConfigs
.FirstAsync(x => x.Type == InstanceType.Radarr);
var lidarrConfig = await _dataContext.ArrConfigs
.Include(x => x.Instances)
.AsNoTracking()
.FirstAsync();
.FirstAsync(x => x.Type == InstanceType.Lidarr);
// Check Sonarr instances
if (sonarrConfig is { Enabled: true, Instances.Count: > 0 })

View File

@@ -1,5 +1,5 @@
using System.ComponentModel.DataAnnotations;
using Common.Configuration.Arr;
using Data.Models.Configuration.Arr;
namespace Executable.DTOs;

View File

@@ -1,5 +1,5 @@
using System.Net;
using Common.Configuration.General;
using Data.Models.Configuration.General;
using Data.Models.Arr;
using Infrastructure.Health;
using Infrastructure.Http;

View File

@@ -1,5 +1,6 @@
using Common.Configuration.DownloadCleaner;
using Common.Configuration.QueueCleaner;
using Common.Configuration;
using Data.Models.Configuration.DownloadCleaner;
using Data.Models.Configuration.QueueCleaner;
using Common.Exceptions;
using Common.Helpers;
using Data;
@@ -125,7 +126,7 @@ public class BackgroundJobManager : IHostedService
/// Helper method to add a job with a cron trigger.
/// </summary>
private async Task AddJobWithTrigger<T>(
Common.Configuration.IJobConfig config,
IJobConfig config,
string cronExpression,
CancellationToken cancellationToken = default)
where T : GenericHandler

View File

@@ -1,6 +1,6 @@
using System.Collections.Concurrent;
using System.Text.RegularExpressions;
using Common.Configuration.QueueCleaner;
using Data.Models.Configuration.QueueCleaner;
using Shouldly;
namespace Infrastructure.Tests.Verticals.ContentBlocker;

View File

@@ -1,6 +1,6 @@
// using Common.Configuration.ContentBlocker;
// using Common.Configuration.DownloadCleaner;
// using Common.Configuration.QueueCleaner;
// using Data.Models.Configuration.ContentBlocker;
// using Data.Models.Configuration.DownloadCleaner;
// using Data.Models.Configuration.QueueCleaner;
// using Infrastructure.Interceptors;
// using Infrastructure.Verticals.ContentBlocker;
// using Infrastructure.Verticals.DownloadClient;

View File

@@ -1,4 +1,4 @@
// using Common.Configuration.DownloadCleaner;
// using Data.Models.Configuration.DownloadCleaner;
// using Data.Enums;
// using Data.Models.Cache;
// using Infrastructure.Helpers;

View File

@@ -1,6 +1,6 @@
using System.Net;
using Common.Configuration;
using Common.Configuration.General;
using Data.Models.Configuration.General;
using Data;
using Infrastructure.Services;
using Microsoft.Extensions.Logging;

View File

@@ -1,6 +1,6 @@
using Common.Attributes;
using Common.Configuration.Arr;
using Common.Configuration.QueueCleaner;
using Data.Models.Configuration.Arr;
using Data.Models.Configuration.QueueCleaner;
using Common.Helpers;
using Data.Enums;
using Data.Models.Arr;

View File

@@ -1,5 +1,5 @@
using Common.Configuration;
using Common.Configuration.Arr;
using Data.Models.Configuration.Arr;
using Data.Models.Arr.Queue;
using Infrastructure.Verticals.Arr.Interfaces;
using Microsoft.Extensions.Logging;

View File

@@ -1,4 +1,4 @@
using Common.Configuration.Arr;
using Data.Models.Configuration.Arr;
using Data.Enums;
using Data.Models.Arr;
using Data.Models.Arr.Queue;

View File

@@ -1,5 +1,5 @@
using System.Text;
using Common.Configuration.Arr;
using Data.Models.Configuration.Arr;
using Data.Models.Arr;
using Data.Models.Arr.Queue;
using Data.Models.Lidarr;

View File

@@ -1,5 +1,5 @@
using System.Text;
using Common.Configuration.Arr;
using Data.Models.Configuration.Arr;
using Data.Models.Arr;
using Data.Models.Arr.Queue;
using Data.Models.Radarr;

View File

@@ -1,5 +1,5 @@
using System.Text;
using Common.Configuration.Arr;
using Data.Models.Configuration.Arr;
using Data.Models.Arr;
using Data.Models.Arr.Queue;
using Data.Models.Sonarr;

View File

@@ -3,7 +3,7 @@ using System.Diagnostics;
using System.Security.Cryptography;
using System.Text;
using System.Text.RegularExpressions;
using Common.Configuration.QueueCleaner;
using Data.Models.Configuration.QueueCleaner;
using Common.Helpers;
using Data;
using Data.Enums;

View File

@@ -1,6 +1,6 @@
using System.Collections.Concurrent;
using System.Text.RegularExpressions;
using Common.Configuration.QueueCleaner;
using Data.Models.Configuration.QueueCleaner;
using Microsoft.Extensions.Logging;
namespace Infrastructure.Verticals.ContentBlocker;

View File

@@ -1,6 +1,6 @@
using System.Collections.Concurrent;
using System.Text.RegularExpressions;
using Common.Configuration.QueueCleaner;
using Data.Models.Configuration.QueueCleaner;
namespace Infrastructure.Verticals.ContentBlocker;

View File

@@ -1,9 +1,10 @@
using Common.Configuration.Arr;
using Common.Configuration.DownloadCleaner;
using Common.Configuration.General;
using Data.Models.Configuration.Arr;
using Data.Models.Configuration.DownloadCleaner;
using Data.Models.Configuration.General;
using Data;
using Data.Enums;
using Data.Models.Arr.Queue;
using Data.Models.Configuration.Arr;
using Infrastructure.Events;
using Infrastructure.Helpers;
using Infrastructure.Verticals.Arr;
@@ -162,9 +163,9 @@ public sealed class DownloadCleaner : GenericHandler
// wait for the downloads to appear in the arr queue
await Task.Delay(10 * 1000);
await ProcessArrConfigAsync(ContextProvider.Get<SonarrConfig>(), InstanceType.Sonarr, true);
await ProcessArrConfigAsync(ContextProvider.Get<SonarrConfig>(), InstanceType.Radarr, true);
await ProcessArrConfigAsync(ContextProvider.Get<SonarrConfig>(), InstanceType.Lidarr, true);
await ProcessArrConfigAsync(ContextProvider.Get<ArrConfig>(nameof(InstanceType.Sonarr)), InstanceType.Sonarr, true);
await ProcessArrConfigAsync(ContextProvider.Get<ArrConfig>(nameof(InstanceType.Radarr)), InstanceType.Radarr, true);
await ProcessArrConfigAsync(ContextProvider.Get<ArrConfig>(nameof(InstanceType.Lidarr)), InstanceType.Lidarr, true);
if (isUnlinkedEnabled && downloadsToChangeCategory?.Count > 0)
{

View File

@@ -13,7 +13,7 @@ namespace Infrastructure.Verticals.DownloadClient.Deluge;
public sealed class DelugeClient
{
private readonly Common.Configuration.DownloadClientConfig _config;
private readonly DownloadClientConfig _config;
private readonly HttpClient _httpClient;
private static readonly IReadOnlyList<string> Fields =
@@ -33,7 +33,7 @@ public sealed class DelugeClient
"download_location"
];
public DelugeClient(Common.Configuration.DownloadClientConfig config, HttpClient httpClient)
public DelugeClient(DownloadClientConfig config, HttpClient httpClient)
{
_config = config;
_httpClient = httpClient;

View File

@@ -1,3 +1,4 @@
using Common.Configuration;
using Common.Exceptions;
using Data;
using Data.Models.Deluge.Response;
@@ -37,7 +38,7 @@ public partial class DelugeService : DownloadService, IDelugeService
}
/// <inheritdoc />
public override void Initialize(Common.Configuration.DownloadClientConfig downloadClientConfig)
public override void Initialize(DownloadClientConfig downloadClientConfig)
{
// Initialize base service first
base.Initialize(downloadClientConfig);

View File

@@ -1,5 +1,5 @@
using Common.Attributes;
using Common.Configuration.DownloadCleaner;
using Data.Models.Configuration.DownloadCleaner;
using Data.Enums;
using Data.Models.Deluge.Response;
using Infrastructure.Extensions;

View File

@@ -1,7 +1,7 @@
using System.Collections.Concurrent;
using System.Text.RegularExpressions;
using Common.Attributes;
using Common.Configuration.QueueCleaner;
using Data.Models.Configuration.QueueCleaner;
using Common.CustomDataTypes;
using Data.Enums;
using Data.Models.Deluge.Response;

View File

@@ -1,5 +1,6 @@
using Common.Configuration.DownloadCleaner;
using Common.Configuration.QueueCleaner;
using Common.Configuration;
using Data.Models.Configuration.DownloadCleaner;
using Data.Models.Configuration.QueueCleaner;
using Common.CustomDataTypes;
using Common.Helpers;
using Data;
@@ -36,7 +37,7 @@ public abstract class DownloadService : IDownloadService
// Client-specific configuration
protected Common.Configuration.DownloadClientConfig _downloadClientConfig;
protected DownloadClientConfig _downloadClientConfig;
// HTTP client for this service
@@ -75,7 +76,7 @@ public abstract class DownloadService : IDownloadService
}
/// <inheritdoc />
public virtual void Initialize(Common.Configuration.DownloadClientConfig downloadClientConfig)
public virtual void Initialize(DownloadClientConfig downloadClientConfig)
{
_downloadClientConfig = downloadClientConfig;

View File

@@ -76,7 +76,7 @@ public sealed class DownloadServiceFactory
/// <typeparam name="T">The type of download service to create</typeparam>
/// <param name="downloadClientConfig">The client configuration</param>
/// <returns>An implementation of IDownloadService</returns>
private T CreateClientService<T>(Common.Configuration.DownloadClientConfig downloadClientConfig) where T : IDownloadService
private T CreateClientService<T>(DownloadClientConfig downloadClientConfig) where T : IDownloadService
{
var service = _serviceProvider.GetRequiredService<T>();
service.Initialize(downloadClientConfig);

View File

@@ -1,7 +1,8 @@
using System.Collections.Concurrent;
using System.Text.RegularExpressions;
using Common.Configuration.DownloadCleaner;
using Common.Configuration.QueueCleaner;
using Common.Configuration;
using Data.Models.Configuration.DownloadCleaner;
using Data.Models.Configuration.QueueCleaner;
using Data.Enums;
using Infrastructure.Interceptors;
using QBittorrent.Client;
@@ -20,7 +21,7 @@ public interface IDownloadService : IDisposable
/// Initializes the download service with client-specific configuration
/// </summary>
/// <param name="downloadClientConfig">The client configuration</param>
public void Initialize(Common.Configuration.DownloadClientConfig downloadClientConfig);
public void Initialize(DownloadClientConfig downloadClientConfig);
public Task LoginAsync();

View File

@@ -1,3 +1,4 @@
using Common.Configuration;
using Data;
using Infrastructure.Http;
using Infrastructure.Interceptors;
@@ -35,7 +36,7 @@ public partial class QBitService : DownloadService, IQBitService
}
/// <inheritdoc />
public override void Initialize(Common.Configuration.DownloadClientConfig downloadClientConfig)
public override void Initialize(DownloadClientConfig downloadClientConfig)
{
// Initialize base service first
base.Initialize(downloadClientConfig);

View File

@@ -1,5 +1,5 @@
using Common.Attributes;
using Common.Configuration.DownloadCleaner;
using Data.Models.Configuration.DownloadCleaner;
using Data.Enums;
using Infrastructure.Extensions;
using Infrastructure.Verticals.Context;

View File

@@ -1,7 +1,7 @@
using System.Collections.Concurrent;
using System.Text.RegularExpressions;
using Common.Attributes;
using Common.Configuration.QueueCleaner;
using Data.Models.Configuration.QueueCleaner;
using Common.CustomDataTypes;
using Data.Enums;
using Infrastructure.Extensions;

View File

@@ -1,3 +1,4 @@
using Common.Configuration;
using Infrastructure.Events;
using Infrastructure.Interceptors;
using Infrastructure.Verticals.ContentBlocker;
@@ -54,7 +55,7 @@ public partial class TransmissionService : DownloadService, ITransmissionService
}
/// <inheritdoc />
public override void Initialize(Common.Configuration.DownloadClientConfig downloadClientConfig)
public override void Initialize(DownloadClientConfig downloadClientConfig)
{
// Initialize base service first
base.Initialize(downloadClientConfig);

View File

@@ -1,5 +1,5 @@
using Common.Attributes;
using Common.Configuration.DownloadCleaner;
using Data.Models.Configuration.DownloadCleaner;
using Data.Enums;
using Infrastructure.Extensions;
using Infrastructure.Verticals.Context;

View File

@@ -1,7 +1,7 @@
using System.Collections.Concurrent;
using System.Text.RegularExpressions;
using Common.Attributes;
using Common.Configuration.QueueCleaner;
using Data.Models.Configuration.QueueCleaner;
using Common.CustomDataTypes;
using Data.Enums;
using Infrastructure.Extensions;

View File

@@ -1,4 +1,4 @@
using Common.Configuration.Arr;
using Data.Models.Configuration.Arr;
using Data.Enums;
using Data.Models.Arr;
using Data.Models.Arr.Queue;

View File

@@ -1,4 +1,4 @@
using Common.Configuration.Arr;
using Data.Models.Configuration.Arr;
using Data;
using Data.Enums;
using Data.Models.Arr;

View File

@@ -1,12 +1,13 @@
using Common.Configuration;
using Common.Configuration.Arr;
using Common.Configuration.DownloadCleaner;
using Common.Configuration.General;
using Common.Configuration.QueueCleaner;
using Data.Models.Configuration.Arr;
using Data.Models.Configuration.DownloadCleaner;
using Data.Models.Configuration.General;
using Data.Models.Configuration.QueueCleaner;
using Data;
using Data.Enums;
using Data.Models.Arr;
using Data.Models.Arr.Queue;
using Data.Models.Configuration.Arr;
using Infrastructure.Events;
using Infrastructure.Verticals.Arr;
using Infrastructure.Verticals.Context;
@@ -120,9 +121,15 @@ public abstract class GenericHandler : IHandler
try
{
ContextProvider.Set(nameof(GeneralConfig), await _dataContext.GeneralConfigs.FirstAsync());
ContextProvider.Set(nameof(SonarrConfig), await _dataContext.SonarrConfigs.Include(x => x.Instances).FirstAsync());
ContextProvider.Set(nameof(RadarrConfig), await _dataContext.RadarrConfigs.Include(x => x.Instances).FirstAsync());
ContextProvider.Set(nameof(LidarrConfig), await _dataContext.LidarrConfigs.Include(x => x.Instances).FirstAsync());
ContextProvider.Set(nameof(InstanceType.Sonarr), await _dataContext.ArrConfigs
.Include(x => x.Instances)
.FirstAsync(x => x.Type == InstanceType.Sonarr));
ContextProvider.Set(nameof(InstanceType.Radarr), await _dataContext.ArrConfigs
.Include(x => x.Instances)
.FirstAsync(x => x.Type == InstanceType.Radarr));
ContextProvider.Set(nameof(InstanceType.Lidarr), await _dataContext.ArrConfigs
.Include(x => x.Instances)
.FirstAsync(x => x.Type == InstanceType.Lidarr));
ContextProvider.Set(nameof(QueueCleanerConfig), await _dataContext.QueueCleanerConfigs.FirstAsync());
ContextProvider.Set(nameof(DownloadCleanerConfig), await _dataContext.DownloadCleanerConfigs.FirstAsync());
ContextProvider.Set(nameof(DownloadClientConfig), await _dataContext.DownloadClients

View File

@@ -1,5 +1,5 @@
using System.Text;
using Common.Configuration.Notification;
using Data.Models.Configuration.Notification;
using Data;
using Infrastructure.Verticals.Notifications.Models;

View File

@@ -1,5 +1,5 @@
using System.Text;
using Common.Configuration.Notification;
using Data.Models.Configuration.Notification;
using Common.Helpers;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;

View File

@@ -1,4 +1,4 @@
using Common.Configuration.Notification;
using Data.Models.Configuration.Notification;
namespace Infrastructure.Verticals.Notifications.Apprise;

View File

@@ -1,4 +1,4 @@
using Common.Configuration.Notification;
using Data.Models.Configuration.Notification;
using Infrastructure.Verticals.Notifications.Models;
namespace Infrastructure.Verticals.Notifications;

View File

@@ -1,4 +1,4 @@
using Common.Configuration.Notification;
using Data.Models.Configuration.Notification;
namespace Infrastructure.Verticals.Notifications.Notifiarr;

View File

@@ -1,4 +1,4 @@
using Common.Configuration.Notification;
using Data.Models.Configuration.Notification;
using Data;
using Infrastructure.Verticals.Notifications.Models;
using Mapster;

View File

@@ -1,5 +1,5 @@
using System.Text;
using Common.Configuration.Notification;
using Data.Models.Configuration.Notification;
using Common.Helpers;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;

View File

@@ -1,4 +1,4 @@
using Common.Configuration.Notification;
using Data.Models.Configuration.Notification;
using Infrastructure.Verticals.Notifications.Models;
using Microsoft.EntityFrameworkCore;

View File

@@ -1,6 +1,6 @@
using System.Globalization;
using Common.Attributes;
using Common.Configuration.Arr;
using Data.Models.Configuration.Arr;
using Data.Enums;
using Data.Models.Arr.Queue;
using Infrastructure.Interceptors;

View File

@@ -1,11 +1,12 @@
using Common.Configuration;
using Common.Configuration.Arr;
using Common.Configuration.General;
using Common.Configuration.QueueCleaner;
using Data.Models.Configuration.Arr;
using Data.Models.Configuration.General;
using Data.Models.Configuration.QueueCleaner;
using Common.Enums;
using Data;
using Data.Enums;
using Data.Models.Arr.Queue;
using Data.Models.Configuration.Arr;
using Infrastructure.Events;
using Infrastructure.Helpers;
using Infrastructure.Verticals.Arr;
@@ -56,9 +57,9 @@ public sealed class QueueCleaner : GenericHandler
await _blocklistProvider.LoadBlocklistsAsync();
var sonarrConfig = ContextProvider.Get<SonarrConfig>();
var radarrConfig = ContextProvider.Get<RadarrConfig>();
var lidarrConfig = ContextProvider.Get<LidarrConfig>();
var sonarrConfig = ContextProvider.Get<ArrConfig>(nameof(InstanceType.Sonarr));
var radarrConfig = ContextProvider.Get<ArrConfig>(nameof(InstanceType.Radarr));
var lidarrConfig = ContextProvider.Get<ArrConfig>(nameof(InstanceType.Lidarr));
var config = ContextProvider.Get<QueueCleanerConfig>();
bool blocklistIsConfigured = sonarrConfig.Enabled && !string.IsNullOrEmpty(config.ContentBlocker.Sonarr.BlocklistPath) ||

View File

@@ -6,25 +6,6 @@
<h1>Settings</h1>
</div>
<!-- General Settings Component -->
<div class="mb-4">
<app-general-settings></app-general-settings>
</div>
<!-- Download Client Component -->
<div class="mb-4">
<app-download-client-settings></app-download-client-settings>
</div>
<!-- Queue Cleaner Component -->
<div class="mb-4">
<app-queue-cleaner-settings></app-queue-cleaner-settings>
</div>
<!-- Download Cleaner Component -->
<div class="mb-4">
<app-download-cleaner-settings></app-download-cleaner-settings>
</div>
<!-- Sonarr Settings Component -->
<div class="mb-4">