diff --git a/code/Common/Configuration/Arr/LidarrConfig.cs b/code/Common/Configuration/Arr/LidarrConfig.cs deleted file mode 100644 index a28aa646..00000000 --- a/code/Common/Configuration/Arr/LidarrConfig.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace Common.Configuration.Arr; - -public sealed class LidarrConfig : ArrConfig -{ - public override void Validate() - { - } -} \ No newline at end of file diff --git a/code/Common/Configuration/Arr/RadarrConfig.cs b/code/Common/Configuration/Arr/RadarrConfig.cs deleted file mode 100644 index 33973e7d..00000000 --- a/code/Common/Configuration/Arr/RadarrConfig.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace Common.Configuration.Arr; - -public sealed class RadarrConfig : ArrConfig -{ - public override void Validate() - { - } -} \ No newline at end of file diff --git a/code/Common/Configuration/Arr/SonarrConfig.cs b/code/Common/Configuration/Arr/SonarrConfig.cs deleted file mode 100644 index d6cbbe21..00000000 --- a/code/Common/Configuration/Arr/SonarrConfig.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace Common.Configuration.Arr; - -public sealed class SonarrConfig : ArrConfig -{ - public override void Validate() - { - } -} \ No newline at end of file diff --git a/code/Data/DataContext.cs b/code/Data/DataContext.cs index e4b74336..8cb42b4e 100644 --- a/code/Data/DataContext.cs +++ b/code/Data/DataContext.cs @@ -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 DownloadCleanerConfigs { get; set; } - public DbSet SonarrConfigs { get; set; } - - public DbSet RadarrConfigs { get; set; } - - public DbSet LidarrConfigs { get; set; } + public DbSet ArrConfigs { get; set; } public DbSet ArrInstances { get; set; } diff --git a/code/Data/Migrations/Data/20250614220030_InitialData.Designer.cs b/code/Data/Migrations/Data/20250615170420_InitialData.Designer.cs similarity index 77% rename from code/Data/Migrations/Data/20250614220030_InitialData.Designer.cs rename to code/Data/Migrations/Data/20250615170420_InitialData.Designer.cs index 554ebf9c..7c49ae6d 100644 --- a/code/Data/Migrations/Data/20250614220030_InitialData.Designer.cs +++ b/code/Data/Migrations/Data/20250615170420_InitialData.Designer.cs @@ -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 { /// @@ -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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT") + .HasColumnName("id"); + + b.Property("Enabled") + .HasColumnType("INTEGER") + .HasColumnName("enabled"); + + b.Property("Host") + .HasColumnType("TEXT") + .HasColumnName("host"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT") + .HasColumnName("name"); + + b.Property("Password") + .HasColumnType("TEXT") + .HasColumnName("password"); + + b.Property("Type") + .IsRequired() + .HasColumnType("TEXT") + .HasColumnName("type"); + + b.Property("TypeName") + .IsRequired() + .HasColumnType("TEXT") + .HasColumnName("type_name"); + + b.Property("UrlBase") + .HasColumnType("TEXT") + .HasColumnName("url_base"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT") + .HasColumnName("id"); + + b.Property("Enabled") + .HasColumnType("INTEGER") + .HasColumnName("enabled"); + + b.Property("FailedImportMaxStrikes") + .HasColumnType("INTEGER") + .HasColumnName("failed_import_max_strikes"); + + b.Property("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("Id") .ValueGeneratedOnAdd() @@ -33,112 +107,30 @@ namespace Data.Migrations.Data .HasColumnType("TEXT") .HasColumnName("api_key"); - b.Property("LidarrConfigId") + b.Property("ArrConfigId") .HasColumnType("TEXT") - .HasColumnName("lidarr_config_id"); + .HasColumnName("arr_config_id"); b.Property("Name") .IsRequired() .HasColumnType("TEXT") .HasColumnName("name"); - b.Property("RadarrConfigId") - .HasColumnType("TEXT") - .HasColumnName("radarr_config_id"); - - b.Property("SonarrConfigId") - .HasColumnType("TEXT") - .HasColumnName("sonarr_config_id"); - b.Property("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("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT") - .HasColumnName("id"); - - b.Property("Enabled") - .HasColumnType("INTEGER") - .HasColumnName("enabled"); - - b.Property("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("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT") - .HasColumnName("id"); - - b.Property("Enabled") - .HasColumnType("INTEGER") - .HasColumnName("enabled"); - - b.Property("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("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT") - .HasColumnName("id"); - - b.Property("Enabled") - .HasColumnType("INTEGER") - .HasColumnName("enabled"); - - b.Property("FailedImportMaxStrikes") - .HasColumnType("INTEGER") - .HasColumnName("failed_import_max_strikes"); - - b.Property("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("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("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("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT") - .HasColumnName("id"); - - b.Property("Enabled") - .HasColumnType("INTEGER") - .HasColumnName("enabled"); - - b.Property("Host") - .HasColumnType("TEXT") - .HasColumnName("host"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT") - .HasColumnName("name"); - - b.Property("Password") - .HasColumnType("TEXT") - .HasColumnName("password"); - - b.Property("Type") - .IsRequired() - .HasColumnType("TEXT") - .HasColumnName("type"); - - b.Property("TypeName") - .IsRequired() - .HasColumnType("TEXT") - .HasColumnName("type_name"); - - b.Property("UrlBase") - .HasColumnType("TEXT") - .HasColumnName("url_base"); - - b.Property("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("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("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("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("Id") .ValueGeneratedOnAdd() @@ -439,7 +383,7 @@ namespace Data.Migrations.Data .HasColumnType("INTEGER") .HasColumnName("use_advanced_scheduling"); - b.ComplexProperty>("ContentBlocker", "Common.Configuration.QueueCleaner.QueueCleanerConfig.ContentBlocker#ContentBlockerConfig", b1 => + b.ComplexProperty>("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>("Lidarr", "Common.Configuration.QueueCleaner.QueueCleanerConfig.ContentBlocker#ContentBlockerConfig.Lidarr#BlocklistSettings", b2 => + b1.ComplexProperty>("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>("Radarr", "Common.Configuration.QueueCleaner.QueueCleanerConfig.ContentBlocker#ContentBlockerConfig.Radarr#BlocklistSettings", b2 => + b1.ComplexProperty>("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>("Sonarr", "Common.Configuration.QueueCleaner.QueueCleanerConfig.ContentBlocker#ContentBlockerConfig.Sonarr#BlocklistSettings", b2 => + b1.ComplexProperty>("Sonarr", "Data.Models.Configuration.QueueCleaner.QueueCleanerConfig.ContentBlocker#ContentBlockerConfig.Sonarr#BlocklistSettings", b2 => { b2.IsRequired(); @@ -495,7 +439,7 @@ namespace Data.Migrations.Data }); }); - b.ComplexProperty>("FailedImport", "Common.Configuration.QueueCleaner.QueueCleanerConfig.FailedImport#FailedImportConfig", b1 => + b.ComplexProperty>("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>("Slow", "Common.Configuration.QueueCleaner.QueueCleanerConfig.Slow#SlowConfig", b1 => + b.ComplexProperty>("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>("Stalled", "Common.Configuration.QueueCleaner.QueueCleanerConfig.Stalled#StalledConfig", b1 => + b.ComplexProperty>("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"); }); diff --git a/code/Data/Migrations/Data/20250614220030_InitialData.cs b/code/Data/Migrations/Data/20250615170420_InitialData.cs similarity index 82% rename from code/Data/Migrations/Data/20250614220030_InitialData.cs rename to code/Data/Migrations/Data/20250615170420_InitialData.cs index 4d36c664..7ceaeae5 100644 --- a/code/Data/Migrations/Data/20250614220030_InitialData.cs +++ b/code/Data/Migrations/Data/20250615170420_InitialData.cs @@ -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(type: "TEXT", nullable: false), + type = table.Column(type: "TEXT", nullable: false), + enabled = table.Column(type: "INTEGER", nullable: false), + failed_import_max_strikes = table.Column(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(type: "TEXT", nullable: false), - enabled = table.Column(type: "INTEGER", nullable: false), - failed_import_max_strikes = table.Column(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(type: "TEXT", nullable: false), - enabled = table.Column(type: "INTEGER", nullable: false), - failed_import_max_strikes = table.Column(type: "INTEGER", nullable: false) + arr_config_id = table.Column(type: "TEXT", nullable: false), + name = table.Column(type: "TEXT", nullable: false), + url = table.Column(type: "TEXT", nullable: false), + api_key = table.Column(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(type: "TEXT", nullable: false), - search_type = table.Column(type: "TEXT", nullable: false), - enabled = table.Column(type: "INTEGER", nullable: false), - failed_import_max_strikes = table.Column(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(type: "TEXT", nullable: false), - name = table.Column(type: "TEXT", nullable: false), - url = table.Column(type: "TEXT", nullable: false), - api_key = table.Column(type: "TEXT", nullable: false), - lidarr_config_id = table.Column(type: "TEXT", nullable: true), - radarr_config_id = table.Column(type: "TEXT", nullable: true), - sonarr_config_id = table.Column(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"); } /// @@ -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"); diff --git a/code/Data/Migrations/Data/DataContextModelSnapshot.cs b/code/Data/Migrations/Data/DataContextModelSnapshot.cs index f6c45686..db68d83d 100644 --- a/code/Data/Migrations/Data/DataContextModelSnapshot.cs +++ b/code/Data/Migrations/Data/DataContextModelSnapshot.cs @@ -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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT") + .HasColumnName("id"); + + b.Property("Enabled") + .HasColumnType("INTEGER") + .HasColumnName("enabled"); + + b.Property("Host") + .HasColumnType("TEXT") + .HasColumnName("host"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT") + .HasColumnName("name"); + + b.Property("Password") + .HasColumnType("TEXT") + .HasColumnName("password"); + + b.Property("Type") + .IsRequired() + .HasColumnType("TEXT") + .HasColumnName("type"); + + b.Property("TypeName") + .IsRequired() + .HasColumnType("TEXT") + .HasColumnName("type_name"); + + b.Property("UrlBase") + .HasColumnType("TEXT") + .HasColumnName("url_base"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT") + .HasColumnName("id"); + + b.Property("Enabled") + .HasColumnType("INTEGER") + .HasColumnName("enabled"); + + b.Property("FailedImportMaxStrikes") + .HasColumnType("INTEGER") + .HasColumnName("failed_import_max_strikes"); + + b.Property("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("Id") .ValueGeneratedOnAdd() @@ -30,112 +104,30 @@ namespace Data.Migrations.Data .HasColumnType("TEXT") .HasColumnName("api_key"); - b.Property("LidarrConfigId") + b.Property("ArrConfigId") .HasColumnType("TEXT") - .HasColumnName("lidarr_config_id"); + .HasColumnName("arr_config_id"); b.Property("Name") .IsRequired() .HasColumnType("TEXT") .HasColumnName("name"); - b.Property("RadarrConfigId") - .HasColumnType("TEXT") - .HasColumnName("radarr_config_id"); - - b.Property("SonarrConfigId") - .HasColumnType("TEXT") - .HasColumnName("sonarr_config_id"); - b.Property("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("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT") - .HasColumnName("id"); - - b.Property("Enabled") - .HasColumnType("INTEGER") - .HasColumnName("enabled"); - - b.Property("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("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT") - .HasColumnName("id"); - - b.Property("Enabled") - .HasColumnType("INTEGER") - .HasColumnName("enabled"); - - b.Property("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("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT") - .HasColumnName("id"); - - b.Property("Enabled") - .HasColumnType("INTEGER") - .HasColumnName("enabled"); - - b.Property("FailedImportMaxStrikes") - .HasColumnType("INTEGER") - .HasColumnName("failed_import_max_strikes"); - - b.Property("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("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("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("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT") - .HasColumnName("id"); - - b.Property("Enabled") - .HasColumnType("INTEGER") - .HasColumnName("enabled"); - - b.Property("Host") - .HasColumnType("TEXT") - .HasColumnName("host"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT") - .HasColumnName("name"); - - b.Property("Password") - .HasColumnType("TEXT") - .HasColumnName("password"); - - b.Property("Type") - .IsRequired() - .HasColumnType("TEXT") - .HasColumnName("type"); - - b.Property("TypeName") - .IsRequired() - .HasColumnType("TEXT") - .HasColumnName("type_name"); - - b.Property("UrlBase") - .HasColumnType("TEXT") - .HasColumnName("url_base"); - - b.Property("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("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("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("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("Id") .ValueGeneratedOnAdd() @@ -436,7 +380,7 @@ namespace Data.Migrations.Data .HasColumnType("INTEGER") .HasColumnName("use_advanced_scheduling"); - b.ComplexProperty>("ContentBlocker", "Common.Configuration.QueueCleaner.QueueCleanerConfig.ContentBlocker#ContentBlockerConfig", b1 => + b.ComplexProperty>("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>("Lidarr", "Common.Configuration.QueueCleaner.QueueCleanerConfig.ContentBlocker#ContentBlockerConfig.Lidarr#BlocklistSettings", b2 => + b1.ComplexProperty>("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>("Radarr", "Common.Configuration.QueueCleaner.QueueCleanerConfig.ContentBlocker#ContentBlockerConfig.Radarr#BlocklistSettings", b2 => + b1.ComplexProperty>("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>("Sonarr", "Common.Configuration.QueueCleaner.QueueCleanerConfig.ContentBlocker#ContentBlockerConfig.Sonarr#BlocklistSettings", b2 => + b1.ComplexProperty>("Sonarr", "Data.Models.Configuration.QueueCleaner.QueueCleanerConfig.ContentBlocker#ContentBlockerConfig.Sonarr#BlocklistSettings", b2 => { b2.IsRequired(); @@ -492,7 +436,7 @@ namespace Data.Migrations.Data }); }); - b.ComplexProperty>("FailedImport", "Common.Configuration.QueueCleaner.QueueCleanerConfig.FailedImport#FailedImportConfig", b1 => + b.ComplexProperty>("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>("Slow", "Common.Configuration.QueueCleaner.QueueCleanerConfig.Slow#SlowConfig", b1 => + b.ComplexProperty>("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>("Stalled", "Common.Configuration.QueueCleaner.QueueCleanerConfig.Stalled#StalledConfig", b1 => + b.ComplexProperty>("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"); }); diff --git a/code/Data/Models/Arr/SonarrSearchItem.cs b/code/Data/Models/Arr/SonarrSearchItem.cs index 18c996d5..08c2b0f4 100644 --- a/code/Data/Models/Arr/SonarrSearchItem.cs +++ b/code/Data/Models/Arr/SonarrSearchItem.cs @@ -1,4 +1,4 @@ -using Common.Configuration.Arr; +using Data.Models.Configuration.Arr; namespace Data.Models.Arr; diff --git a/code/Common/Configuration/Arr/ArrConfig.cs b/code/Data/Models/Configuration/Arr/ArrConfig.cs similarity index 64% rename from code/Common/Configuration/Arr/ArrConfig.cs rename to code/Data/Models/Configuration/Arr/ArrConfig.cs index abc9881c..30447aa0 100644 --- a/code/Common/Configuration/Arr/ArrConfig.cs +++ b/code/Data/Models/Configuration/Arr/ArrConfig.cs @@ -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 Instances { get; set; } = []; - public abstract void Validate(); + public void Validate() + { + } } \ No newline at end of file diff --git a/code/Common/Configuration/Arr/ArrInstance.cs b/code/Data/Models/Configuration/Arr/ArrInstance.cs similarity index 76% rename from code/Common/Configuration/Arr/ArrInstance.cs rename to code/Data/Models/Configuration/Arr/ArrInstance.cs index f0fc236c..d7659de4 100644 --- a/code/Common/Configuration/Arr/ArrInstance.cs +++ b/code/Data/Models/Configuration/Arr/ArrInstance.cs @@ -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; } diff --git a/code/Common/Configuration/Arr/SonarrSearchType.cs b/code/Data/Models/Configuration/Arr/SonarrSearchType.cs similarity index 60% rename from code/Common/Configuration/Arr/SonarrSearchType.cs rename to code/Data/Models/Configuration/Arr/SonarrSearchType.cs index 67fd7541..2709aa29 100644 --- a/code/Common/Configuration/Arr/SonarrSearchType.cs +++ b/code/Data/Models/Configuration/Arr/SonarrSearchType.cs @@ -1,4 +1,4 @@ -namespace Common.Configuration.Arr; +namespace Data.Models.Configuration.Arr; public enum SonarrSearchType { diff --git a/code/Common/Configuration/DownloadCleaner/CleanCategory.cs b/code/Data/Models/Configuration/DownloadCleaner/CleanCategory.cs similarity index 94% rename from code/Common/Configuration/DownloadCleaner/CleanCategory.cs rename to code/Data/Models/Configuration/DownloadCleaner/CleanCategory.cs index f7354aac..a9a475da 100644 --- a/code/Common/Configuration/DownloadCleaner/CleanCategory.cs +++ b/code/Data/Models/Configuration/DownloadCleaner/CleanCategory.cs @@ -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 { diff --git a/code/Common/Configuration/DownloadCleaner/DownloadCleanerConfig.cs b/code/Data/Models/Configuration/DownloadCleaner/DownloadCleanerConfig.cs similarity index 96% rename from code/Common/Configuration/DownloadCleaner/DownloadCleanerConfig.cs rename to code/Data/Models/Configuration/DownloadCleaner/DownloadCleanerConfig.cs index 689ca73f..a00e8b1d 100644 --- a/code/Common/Configuration/DownloadCleaner/DownloadCleanerConfig.cs +++ b/code/Data/Models/Configuration/DownloadCleaner/DownloadCleanerConfig.cs @@ -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 { diff --git a/code/Common/Configuration/DownloadClientConfig.cs b/code/Data/Models/Configuration/DownloadClientConfig.cs similarity index 100% rename from code/Common/Configuration/DownloadClientConfig.cs rename to code/Data/Models/Configuration/DownloadClientConfig.cs diff --git a/code/Common/Configuration/General/GeneralConfig.cs b/code/Data/Models/Configuration/General/GeneralConfig.cs similarity index 93% rename from code/Common/Configuration/General/GeneralConfig.cs rename to code/Data/Models/Configuration/General/GeneralConfig.cs index f2f14181..d2674047 100644 --- a/code/Common/Configuration/General/GeneralConfig.cs +++ b/code/Data/Models/Configuration/General/GeneralConfig.cs @@ -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 { diff --git a/code/Common/Configuration/IConfig.cs b/code/Data/Models/Configuration/IConfig.cs similarity index 100% rename from code/Common/Configuration/IConfig.cs rename to code/Data/Models/Configuration/IConfig.cs diff --git a/code/Common/Configuration/IJobConfig.cs b/code/Data/Models/Configuration/IJobConfig.cs similarity index 100% rename from code/Common/Configuration/IJobConfig.cs rename to code/Data/Models/Configuration/IJobConfig.cs diff --git a/code/Common/Configuration/Notification/AppriseConfig.cs b/code/Data/Models/Configuration/Notification/AppriseConfig.cs similarity index 87% rename from code/Common/Configuration/Notification/AppriseConfig.cs rename to code/Data/Models/Configuration/Notification/AppriseConfig.cs index bdbfeaea..d1905741 100644 --- a/code/Common/Configuration/Notification/AppriseConfig.cs +++ b/code/Data/Models/Configuration/Notification/AppriseConfig.cs @@ -1,4 +1,4 @@ -namespace Common.Configuration.Notification; +namespace Data.Models.Configuration.Notification; public sealed record AppriseConfig : NotificationConfig { diff --git a/code/Common/Configuration/Notification/NotifiarrConfig.cs b/code/Data/Models/Configuration/Notification/NotifiarrConfig.cs similarity index 89% rename from code/Common/Configuration/Notification/NotifiarrConfig.cs rename to code/Data/Models/Configuration/Notification/NotifiarrConfig.cs index b52b6cbd..8cde407e 100644 --- a/code/Common/Configuration/Notification/NotifiarrConfig.cs +++ b/code/Data/Models/Configuration/Notification/NotifiarrConfig.cs @@ -1,4 +1,4 @@ -namespace Common.Configuration.Notification; +namespace Data.Models.Configuration.Notification; public sealed record NotifiarrConfig : NotificationConfig { diff --git a/code/Common/Configuration/Notification/NotificationConfig.cs b/code/Data/Models/Configuration/Notification/NotificationConfig.cs similarity index 94% rename from code/Common/Configuration/Notification/NotificationConfig.cs rename to code/Data/Models/Configuration/Notification/NotificationConfig.cs index 9032df31..dfc3040a 100644 --- a/code/Common/Configuration/Notification/NotificationConfig.cs +++ b/code/Data/Models/Configuration/Notification/NotificationConfig.cs @@ -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 { diff --git a/code/Common/Configuration/QueueCleaner/BlocklistSettings.cs b/code/Data/Models/Configuration/QueueCleaner/BlocklistSettings.cs similarity index 84% rename from code/Common/Configuration/QueueCleaner/BlocklistSettings.cs rename to code/Data/Models/Configuration/QueueCleaner/BlocklistSettings.cs index db1e313a..ded9b14a 100644 --- a/code/Common/Configuration/QueueCleaner/BlocklistSettings.cs +++ b/code/Data/Models/Configuration/QueueCleaner/BlocklistSettings.cs @@ -1,6 +1,6 @@ using System.ComponentModel.DataAnnotations.Schema; -namespace Common.Configuration.QueueCleaner; +namespace Data.Models.Configuration.QueueCleaner; /// /// Settings for a blocklist diff --git a/code/Common/Configuration/QueueCleaner/BlocklistType.cs b/code/Data/Models/Configuration/QueueCleaner/BlocklistType.cs similarity index 51% rename from code/Common/Configuration/QueueCleaner/BlocklistType.cs rename to code/Data/Models/Configuration/QueueCleaner/BlocklistType.cs index 4d371089..e61f5035 100644 --- a/code/Common/Configuration/QueueCleaner/BlocklistType.cs +++ b/code/Data/Models/Configuration/QueueCleaner/BlocklistType.cs @@ -1,4 +1,4 @@ -namespace Common.Configuration.QueueCleaner; +namespace Data.Models.Configuration.QueueCleaner; public enum BlocklistType { diff --git a/code/Common/Configuration/QueueCleaner/ContentBlockerConfig.cs b/code/Data/Models/Configuration/QueueCleaner/ContentBlockerConfig.cs similarity index 90% rename from code/Common/Configuration/QueueCleaner/ContentBlockerConfig.cs rename to code/Data/Models/Configuration/QueueCleaner/ContentBlockerConfig.cs index 6275af59..6136eb73 100644 --- a/code/Common/Configuration/QueueCleaner/ContentBlockerConfig.cs +++ b/code/Data/Models/Configuration/QueueCleaner/ContentBlockerConfig.cs @@ -1,6 +1,6 @@ using System.ComponentModel.DataAnnotations.Schema; -namespace Common.Configuration.QueueCleaner; +namespace Data.Models.Configuration.QueueCleaner; [ComplexType] public sealed record ContentBlockerConfig diff --git a/code/Common/Configuration/QueueCleaner/FailedImportConfig.cs b/code/Data/Models/Configuration/QueueCleaner/FailedImportConfig.cs similarity index 91% rename from code/Common/Configuration/QueueCleaner/FailedImportConfig.cs rename to code/Data/Models/Configuration/QueueCleaner/FailedImportConfig.cs index 6945b956..50f4c0d5 100644 --- a/code/Common/Configuration/QueueCleaner/FailedImportConfig.cs +++ b/code/Data/Models/Configuration/QueueCleaner/FailedImportConfig.cs @@ -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 diff --git a/code/Common/Configuration/QueueCleaner/QueueCleanerConfig.cs b/code/Data/Models/Configuration/QueueCleaner/QueueCleanerConfig.cs similarity index 92% rename from code/Common/Configuration/QueueCleaner/QueueCleanerConfig.cs rename to code/Data/Models/Configuration/QueueCleaner/QueueCleanerConfig.cs index 31f0ca0a..c2064d8f 100644 --- a/code/Common/Configuration/QueueCleaner/QueueCleanerConfig.cs +++ b/code/Data/Models/Configuration/QueueCleaner/QueueCleanerConfig.cs @@ -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 { diff --git a/code/Common/Configuration/QueueCleaner/SlowConfig.cs b/code/Data/Models/Configuration/QueueCleaner/SlowConfig.cs similarity index 97% rename from code/Common/Configuration/QueueCleaner/SlowConfig.cs rename to code/Data/Models/Configuration/QueueCleaner/SlowConfig.cs index 2a80b2fa..2e5c72fa 100644 --- a/code/Common/Configuration/QueueCleaner/SlowConfig.cs +++ b/code/Data/Models/Configuration/QueueCleaner/SlowConfig.cs @@ -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 diff --git a/code/Common/Configuration/QueueCleaner/StalledConfig.cs b/code/Data/Models/Configuration/QueueCleaner/StalledConfig.cs similarity index 94% rename from code/Common/Configuration/QueueCleaner/StalledConfig.cs rename to code/Data/Models/Configuration/QueueCleaner/StalledConfig.cs index ae2ce862..5e0c1141 100644 --- a/code/Common/Configuration/QueueCleaner/StalledConfig.cs +++ b/code/Data/Models/Configuration/QueueCleaner/StalledConfig.cs @@ -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 diff --git a/code/Data/Models/Sonarr/SonarrCommand.cs b/code/Data/Models/Sonarr/SonarrCommand.cs index df536aef..881fd987 100644 --- a/code/Data/Models/Sonarr/SonarrCommand.cs +++ b/code/Data/Models/Sonarr/SonarrCommand.cs @@ -1,4 +1,4 @@ -using Common.Configuration.Arr; +using Data.Models.Configuration.Arr; namespace Data.Models.Sonarr; diff --git a/code/Executable/Controllers/ConfigurationController.cs b/code/Executable/Controllers/ConfigurationController.cs index 1c973674..0c953818 100644 --- a/code/Executable/Controllers/ConfigurationController.cs +++ b/code/Executable/Controllers/ConfigurationController.cs @@ -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() - .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() + // .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() - .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() + // .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) diff --git a/code/Executable/Controllers/StatusController.cs b/code/Executable/Controllers/StatusController.cs index 82996e0f..25b41e7b 100644 --- a/code/Executable/Controllers/StatusController.cs +++ b/code/Executable/Controllers/StatusController.cs @@ -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(); // 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 }) diff --git a/code/Executable/DTOs/UpdateSonarrConfigDto.cs b/code/Executable/DTOs/UpdateSonarrConfigDto.cs index b53fb971..4148fbc0 100644 --- a/code/Executable/DTOs/UpdateSonarrConfigDto.cs +++ b/code/Executable/DTOs/UpdateSonarrConfigDto.cs @@ -1,5 +1,5 @@ using System.ComponentModel.DataAnnotations; -using Common.Configuration.Arr; +using Data.Models.Configuration.Arr; namespace Executable.DTOs; diff --git a/code/Executable/DependencyInjection/MainDI.cs b/code/Executable/DependencyInjection/MainDI.cs index e8fe24b9..58b26143 100644 --- a/code/Executable/DependencyInjection/MainDI.cs +++ b/code/Executable/DependencyInjection/MainDI.cs @@ -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; diff --git a/code/Executable/Jobs/BackgroundJobManager.cs b/code/Executable/Jobs/BackgroundJobManager.cs index d70c22b3..6f41da8e 100644 --- a/code/Executable/Jobs/BackgroundJobManager.cs +++ b/code/Executable/Jobs/BackgroundJobManager.cs @@ -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. /// private async Task AddJobWithTrigger( - Common.Configuration.IJobConfig config, + IJobConfig config, string cronExpression, CancellationToken cancellationToken = default) where T : GenericHandler diff --git a/code/Infrastructure.Tests/Verticals/ContentBlocker/FilenameEvaluatorTests.cs b/code/Infrastructure.Tests/Verticals/ContentBlocker/FilenameEvaluatorTests.cs index ba434556..19e091d6 100644 --- a/code/Infrastructure.Tests/Verticals/ContentBlocker/FilenameEvaluatorTests.cs +++ b/code/Infrastructure.Tests/Verticals/ContentBlocker/FilenameEvaluatorTests.cs @@ -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; diff --git a/code/Infrastructure.Tests/Verticals/DownloadClient/DownloadServiceFixture.cs b/code/Infrastructure.Tests/Verticals/DownloadClient/DownloadServiceFixture.cs index cbc7a9cf..8c341789 100644 --- a/code/Infrastructure.Tests/Verticals/DownloadClient/DownloadServiceFixture.cs +++ b/code/Infrastructure.Tests/Verticals/DownloadClient/DownloadServiceFixture.cs @@ -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; diff --git a/code/Infrastructure.Tests/Verticals/DownloadClient/DownloadServiceTests.cs b/code/Infrastructure.Tests/Verticals/DownloadClient/DownloadServiceTests.cs index 9aee0831..6f0e213b 100644 --- a/code/Infrastructure.Tests/Verticals/DownloadClient/DownloadServiceTests.cs +++ b/code/Infrastructure.Tests/Verticals/DownloadClient/DownloadServiceTests.cs @@ -1,4 +1,4 @@ -// using Common.Configuration.DownloadCleaner; +// using Data.Models.Configuration.DownloadCleaner; // using Data.Enums; // using Data.Models.Cache; // using Infrastructure.Helpers; diff --git a/code/Infrastructure/Http/DynamicHttpClientProvider.cs b/code/Infrastructure/Http/DynamicHttpClientProvider.cs index 501f8a5d..cd1ead8a 100644 --- a/code/Infrastructure/Http/DynamicHttpClientProvider.cs +++ b/code/Infrastructure/Http/DynamicHttpClientProvider.cs @@ -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; diff --git a/code/Infrastructure/Verticals/Arr/ArrClient.cs b/code/Infrastructure/Verticals/Arr/ArrClient.cs index 84ffa2ba..49463b38 100644 --- a/code/Infrastructure/Verticals/Arr/ArrClient.cs +++ b/code/Infrastructure/Verticals/Arr/ArrClient.cs @@ -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; diff --git a/code/Infrastructure/Verticals/Arr/ArrQueueIterator.cs b/code/Infrastructure/Verticals/Arr/ArrQueueIterator.cs index 347dd9c2..4256a57e 100644 --- a/code/Infrastructure/Verticals/Arr/ArrQueueIterator.cs +++ b/code/Infrastructure/Verticals/Arr/ArrQueueIterator.cs @@ -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; diff --git a/code/Infrastructure/Verticals/Arr/Interfaces/IArrClient.cs b/code/Infrastructure/Verticals/Arr/Interfaces/IArrClient.cs index 07ff5e40..d114df95 100644 --- a/code/Infrastructure/Verticals/Arr/Interfaces/IArrClient.cs +++ b/code/Infrastructure/Verticals/Arr/Interfaces/IArrClient.cs @@ -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; diff --git a/code/Infrastructure/Verticals/Arr/LidarrClient.cs b/code/Infrastructure/Verticals/Arr/LidarrClient.cs index 3f3f9a9d..712cf254 100644 --- a/code/Infrastructure/Verticals/Arr/LidarrClient.cs +++ b/code/Infrastructure/Verticals/Arr/LidarrClient.cs @@ -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; diff --git a/code/Infrastructure/Verticals/Arr/RadarrClient.cs b/code/Infrastructure/Verticals/Arr/RadarrClient.cs index a2a12e4c..ac03f95a 100644 --- a/code/Infrastructure/Verticals/Arr/RadarrClient.cs +++ b/code/Infrastructure/Verticals/Arr/RadarrClient.cs @@ -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; diff --git a/code/Infrastructure/Verticals/Arr/SonarrClient.cs b/code/Infrastructure/Verticals/Arr/SonarrClient.cs index 7ac734af..3981d8f9 100644 --- a/code/Infrastructure/Verticals/Arr/SonarrClient.cs +++ b/code/Infrastructure/Verticals/Arr/SonarrClient.cs @@ -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; diff --git a/code/Infrastructure/Verticals/ContentBlocker/BlocklistProvider.cs b/code/Infrastructure/Verticals/ContentBlocker/BlocklistProvider.cs index 8cc53884..705c605f 100644 --- a/code/Infrastructure/Verticals/ContentBlocker/BlocklistProvider.cs +++ b/code/Infrastructure/Verticals/ContentBlocker/BlocklistProvider.cs @@ -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; diff --git a/code/Infrastructure/Verticals/ContentBlocker/FilenameEvaluator.cs b/code/Infrastructure/Verticals/ContentBlocker/FilenameEvaluator.cs index c8cefc87..a7cd9413 100644 --- a/code/Infrastructure/Verticals/ContentBlocker/FilenameEvaluator.cs +++ b/code/Infrastructure/Verticals/ContentBlocker/FilenameEvaluator.cs @@ -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; diff --git a/code/Infrastructure/Verticals/ContentBlocker/IFilenameEvaluator.cs b/code/Infrastructure/Verticals/ContentBlocker/IFilenameEvaluator.cs index 6119f5c6..3a646691 100644 --- a/code/Infrastructure/Verticals/ContentBlocker/IFilenameEvaluator.cs +++ b/code/Infrastructure/Verticals/ContentBlocker/IFilenameEvaluator.cs @@ -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; diff --git a/code/Infrastructure/Verticals/DownloadCleaner/DownloadCleaner.cs b/code/Infrastructure/Verticals/DownloadCleaner/DownloadCleaner.cs index d86747e4..50f7b1d2 100644 --- a/code/Infrastructure/Verticals/DownloadCleaner/DownloadCleaner.cs +++ b/code/Infrastructure/Verticals/DownloadCleaner/DownloadCleaner.cs @@ -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(), InstanceType.Sonarr, true); - await ProcessArrConfigAsync(ContextProvider.Get(), InstanceType.Radarr, true); - await ProcessArrConfigAsync(ContextProvider.Get(), InstanceType.Lidarr, true); + await ProcessArrConfigAsync(ContextProvider.Get(nameof(InstanceType.Sonarr)), InstanceType.Sonarr, true); + await ProcessArrConfigAsync(ContextProvider.Get(nameof(InstanceType.Radarr)), InstanceType.Radarr, true); + await ProcessArrConfigAsync(ContextProvider.Get(nameof(InstanceType.Lidarr)), InstanceType.Lidarr, true); if (isUnlinkedEnabled && downloadsToChangeCategory?.Count > 0) { diff --git a/code/Infrastructure/Verticals/DownloadClient/Deluge/DelugeClient.cs b/code/Infrastructure/Verticals/DownloadClient/Deluge/DelugeClient.cs index 56d5c9fe..e8228bc7 100644 --- a/code/Infrastructure/Verticals/DownloadClient/Deluge/DelugeClient.cs +++ b/code/Infrastructure/Verticals/DownloadClient/Deluge/DelugeClient.cs @@ -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 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; diff --git a/code/Infrastructure/Verticals/DownloadClient/Deluge/DelugeService.cs b/code/Infrastructure/Verticals/DownloadClient/Deluge/DelugeService.cs index 8142e4e6..9a40a360 100644 --- a/code/Infrastructure/Verticals/DownloadClient/Deluge/DelugeService.cs +++ b/code/Infrastructure/Verticals/DownloadClient/Deluge/DelugeService.cs @@ -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 } /// - public override void Initialize(Common.Configuration.DownloadClientConfig downloadClientConfig) + public override void Initialize(DownloadClientConfig downloadClientConfig) { // Initialize base service first base.Initialize(downloadClientConfig); diff --git a/code/Infrastructure/Verticals/DownloadClient/Deluge/DelugeServiceDC.cs b/code/Infrastructure/Verticals/DownloadClient/Deluge/DelugeServiceDC.cs index 78e01f26..690b74b0 100644 --- a/code/Infrastructure/Verticals/DownloadClient/Deluge/DelugeServiceDC.cs +++ b/code/Infrastructure/Verticals/DownloadClient/Deluge/DelugeServiceDC.cs @@ -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; diff --git a/code/Infrastructure/Verticals/DownloadClient/Deluge/DelugeServiceQC.cs b/code/Infrastructure/Verticals/DownloadClient/Deluge/DelugeServiceQC.cs index 7a124f3d..4f10918b 100644 --- a/code/Infrastructure/Verticals/DownloadClient/Deluge/DelugeServiceQC.cs +++ b/code/Infrastructure/Verticals/DownloadClient/Deluge/DelugeServiceQC.cs @@ -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; diff --git a/code/Infrastructure/Verticals/DownloadClient/DownloadService.cs b/code/Infrastructure/Verticals/DownloadClient/DownloadService.cs index 6f726626..27c13c6b 100644 --- a/code/Infrastructure/Verticals/DownloadClient/DownloadService.cs +++ b/code/Infrastructure/Verticals/DownloadClient/DownloadService.cs @@ -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 } /// - public virtual void Initialize(Common.Configuration.DownloadClientConfig downloadClientConfig) + public virtual void Initialize(DownloadClientConfig downloadClientConfig) { _downloadClientConfig = downloadClientConfig; diff --git a/code/Infrastructure/Verticals/DownloadClient/DownloadServiceFactory.cs b/code/Infrastructure/Verticals/DownloadClient/DownloadServiceFactory.cs index 0897e5ec..dd522649 100644 --- a/code/Infrastructure/Verticals/DownloadClient/DownloadServiceFactory.cs +++ b/code/Infrastructure/Verticals/DownloadClient/DownloadServiceFactory.cs @@ -76,7 +76,7 @@ public sealed class DownloadServiceFactory /// The type of download service to create /// The client configuration /// An implementation of IDownloadService - private T CreateClientService(Common.Configuration.DownloadClientConfig downloadClientConfig) where T : IDownloadService + private T CreateClientService(DownloadClientConfig downloadClientConfig) where T : IDownloadService { var service = _serviceProvider.GetRequiredService(); service.Initialize(downloadClientConfig); diff --git a/code/Infrastructure/Verticals/DownloadClient/IDownloadService.cs b/code/Infrastructure/Verticals/DownloadClient/IDownloadService.cs index 4844af43..961fd7e6 100644 --- a/code/Infrastructure/Verticals/DownloadClient/IDownloadService.cs +++ b/code/Infrastructure/Verticals/DownloadClient/IDownloadService.cs @@ -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 /// /// The client configuration - public void Initialize(Common.Configuration.DownloadClientConfig downloadClientConfig); + public void Initialize(DownloadClientConfig downloadClientConfig); public Task LoginAsync(); diff --git a/code/Infrastructure/Verticals/DownloadClient/QBittorrent/QBitService.cs b/code/Infrastructure/Verticals/DownloadClient/QBittorrent/QBitService.cs index 53b2dc88..560177ad 100644 --- a/code/Infrastructure/Verticals/DownloadClient/QBittorrent/QBitService.cs +++ b/code/Infrastructure/Verticals/DownloadClient/QBittorrent/QBitService.cs @@ -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 } /// - public override void Initialize(Common.Configuration.DownloadClientConfig downloadClientConfig) + public override void Initialize(DownloadClientConfig downloadClientConfig) { // Initialize base service first base.Initialize(downloadClientConfig); diff --git a/code/Infrastructure/Verticals/DownloadClient/QBittorrent/QBitServiceDC.cs b/code/Infrastructure/Verticals/DownloadClient/QBittorrent/QBitServiceDC.cs index ae51fb6a..ec484216 100644 --- a/code/Infrastructure/Verticals/DownloadClient/QBittorrent/QBitServiceDC.cs +++ b/code/Infrastructure/Verticals/DownloadClient/QBittorrent/QBitServiceDC.cs @@ -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; diff --git a/code/Infrastructure/Verticals/DownloadClient/QBittorrent/QBitServiceQC.cs b/code/Infrastructure/Verticals/DownloadClient/QBittorrent/QBitServiceQC.cs index ad218b68..ca919ef5 100644 --- a/code/Infrastructure/Verticals/DownloadClient/QBittorrent/QBitServiceQC.cs +++ b/code/Infrastructure/Verticals/DownloadClient/QBittorrent/QBitServiceQC.cs @@ -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; diff --git a/code/Infrastructure/Verticals/DownloadClient/Transmission/TransmissionService.cs b/code/Infrastructure/Verticals/DownloadClient/Transmission/TransmissionService.cs index 1689f88d..c4474392 100644 --- a/code/Infrastructure/Verticals/DownloadClient/Transmission/TransmissionService.cs +++ b/code/Infrastructure/Verticals/DownloadClient/Transmission/TransmissionService.cs @@ -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 } /// - public override void Initialize(Common.Configuration.DownloadClientConfig downloadClientConfig) + public override void Initialize(DownloadClientConfig downloadClientConfig) { // Initialize base service first base.Initialize(downloadClientConfig); diff --git a/code/Infrastructure/Verticals/DownloadClient/Transmission/TransmissionServiceDC.cs b/code/Infrastructure/Verticals/DownloadClient/Transmission/TransmissionServiceDC.cs index cd9a09e7..375fdfa9 100644 --- a/code/Infrastructure/Verticals/DownloadClient/Transmission/TransmissionServiceDC.cs +++ b/code/Infrastructure/Verticals/DownloadClient/Transmission/TransmissionServiceDC.cs @@ -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; diff --git a/code/Infrastructure/Verticals/DownloadClient/Transmission/TransmissionServiceQC.cs b/code/Infrastructure/Verticals/DownloadClient/Transmission/TransmissionServiceQC.cs index 2991ad9b..a90c71a9 100644 --- a/code/Infrastructure/Verticals/DownloadClient/Transmission/TransmissionServiceQC.cs +++ b/code/Infrastructure/Verticals/DownloadClient/Transmission/TransmissionServiceQC.cs @@ -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; diff --git a/code/Infrastructure/Verticals/DownloadRemover/Models/QueueItemRemoveRequest.cs b/code/Infrastructure/Verticals/DownloadRemover/Models/QueueItemRemoveRequest.cs index 6061f628..bf1616ba 100644 --- a/code/Infrastructure/Verticals/DownloadRemover/Models/QueueItemRemoveRequest.cs +++ b/code/Infrastructure/Verticals/DownloadRemover/Models/QueueItemRemoveRequest.cs @@ -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; diff --git a/code/Infrastructure/Verticals/DownloadRemover/QueueItemRemover.cs b/code/Infrastructure/Verticals/DownloadRemover/QueueItemRemover.cs index 0a93f12b..8908be92 100644 --- a/code/Infrastructure/Verticals/DownloadRemover/QueueItemRemover.cs +++ b/code/Infrastructure/Verticals/DownloadRemover/QueueItemRemover.cs @@ -1,4 +1,4 @@ -using Common.Configuration.Arr; +using Data.Models.Configuration.Arr; using Data; using Data.Enums; using Data.Models.Arr; diff --git a/code/Infrastructure/Verticals/Jobs/GenericHandler.cs b/code/Infrastructure/Verticals/Jobs/GenericHandler.cs index 79df23ef..afba0d10 100644 --- a/code/Infrastructure/Verticals/Jobs/GenericHandler.cs +++ b/code/Infrastructure/Verticals/Jobs/GenericHandler.cs @@ -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 diff --git a/code/Infrastructure/Verticals/Notifications/Apprise/AppriseProvider.cs b/code/Infrastructure/Verticals/Notifications/Apprise/AppriseProvider.cs index aefef70a..3f981915 100644 --- a/code/Infrastructure/Verticals/Notifications/Apprise/AppriseProvider.cs +++ b/code/Infrastructure/Verticals/Notifications/Apprise/AppriseProvider.cs @@ -1,5 +1,5 @@ using System.Text; -using Common.Configuration.Notification; +using Data.Models.Configuration.Notification; using Data; using Infrastructure.Verticals.Notifications.Models; diff --git a/code/Infrastructure/Verticals/Notifications/Apprise/AppriseProxy.cs b/code/Infrastructure/Verticals/Notifications/Apprise/AppriseProxy.cs index 5059a0d4..19ca094b 100644 --- a/code/Infrastructure/Verticals/Notifications/Apprise/AppriseProxy.cs +++ b/code/Infrastructure/Verticals/Notifications/Apprise/AppriseProxy.cs @@ -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; diff --git a/code/Infrastructure/Verticals/Notifications/Apprise/IAppriseProxy.cs b/code/Infrastructure/Verticals/Notifications/Apprise/IAppriseProxy.cs index 37aa35ee..256005f5 100644 --- a/code/Infrastructure/Verticals/Notifications/Apprise/IAppriseProxy.cs +++ b/code/Infrastructure/Verticals/Notifications/Apprise/IAppriseProxy.cs @@ -1,4 +1,4 @@ -using Common.Configuration.Notification; +using Data.Models.Configuration.Notification; namespace Infrastructure.Verticals.Notifications.Apprise; diff --git a/code/Infrastructure/Verticals/Notifications/INotificationProvider.cs b/code/Infrastructure/Verticals/Notifications/INotificationProvider.cs index 539cff05..e5d60d6b 100644 --- a/code/Infrastructure/Verticals/Notifications/INotificationProvider.cs +++ b/code/Infrastructure/Verticals/Notifications/INotificationProvider.cs @@ -1,4 +1,4 @@ -using Common.Configuration.Notification; +using Data.Models.Configuration.Notification; using Infrastructure.Verticals.Notifications.Models; namespace Infrastructure.Verticals.Notifications; diff --git a/code/Infrastructure/Verticals/Notifications/Notifiarr/INotifiarrProxy.cs b/code/Infrastructure/Verticals/Notifications/Notifiarr/INotifiarrProxy.cs index e0eecd7b..99e10199 100644 --- a/code/Infrastructure/Verticals/Notifications/Notifiarr/INotifiarrProxy.cs +++ b/code/Infrastructure/Verticals/Notifications/Notifiarr/INotifiarrProxy.cs @@ -1,4 +1,4 @@ -using Common.Configuration.Notification; +using Data.Models.Configuration.Notification; namespace Infrastructure.Verticals.Notifications.Notifiarr; diff --git a/code/Infrastructure/Verticals/Notifications/Notifiarr/NotifiarrProvider.cs b/code/Infrastructure/Verticals/Notifications/Notifiarr/NotifiarrProvider.cs index 8567ccb5..cd0f2e9e 100644 --- a/code/Infrastructure/Verticals/Notifications/Notifiarr/NotifiarrProvider.cs +++ b/code/Infrastructure/Verticals/Notifications/Notifiarr/NotifiarrProvider.cs @@ -1,4 +1,4 @@ -using Common.Configuration.Notification; +using Data.Models.Configuration.Notification; using Data; using Infrastructure.Verticals.Notifications.Models; using Mapster; diff --git a/code/Infrastructure/Verticals/Notifications/Notifiarr/NotifiarrProxy.cs b/code/Infrastructure/Verticals/Notifications/Notifiarr/NotifiarrProxy.cs index 51fbd569..02a5e3cb 100644 --- a/code/Infrastructure/Verticals/Notifications/Notifiarr/NotifiarrProxy.cs +++ b/code/Infrastructure/Verticals/Notifications/Notifiarr/NotifiarrProxy.cs @@ -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; diff --git a/code/Infrastructure/Verticals/Notifications/NotificationProvider.cs b/code/Infrastructure/Verticals/Notifications/NotificationProvider.cs index c6037b30..b634c095 100644 --- a/code/Infrastructure/Verticals/Notifications/NotificationProvider.cs +++ b/code/Infrastructure/Verticals/Notifications/NotificationProvider.cs @@ -1,4 +1,4 @@ -using Common.Configuration.Notification; +using Data.Models.Configuration.Notification; using Infrastructure.Verticals.Notifications.Models; using Microsoft.EntityFrameworkCore; diff --git a/code/Infrastructure/Verticals/Notifications/NotificationPublisher.cs b/code/Infrastructure/Verticals/Notifications/NotificationPublisher.cs index 44005d03..be254d49 100644 --- a/code/Infrastructure/Verticals/Notifications/NotificationPublisher.cs +++ b/code/Infrastructure/Verticals/Notifications/NotificationPublisher.cs @@ -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; diff --git a/code/Infrastructure/Verticals/QueueCleaner/QueueCleaner.cs b/code/Infrastructure/Verticals/QueueCleaner/QueueCleaner.cs index c603f2b7..56bade42 100644 --- a/code/Infrastructure/Verticals/QueueCleaner/QueueCleaner.cs +++ b/code/Infrastructure/Verticals/QueueCleaner/QueueCleaner.cs @@ -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(); - var radarrConfig = ContextProvider.Get(); - var lidarrConfig = ContextProvider.Get(); + var sonarrConfig = ContextProvider.Get(nameof(InstanceType.Sonarr)); + var radarrConfig = ContextProvider.Get(nameof(InstanceType.Radarr)); + var lidarrConfig = ContextProvider.Get(nameof(InstanceType.Lidarr)); var config = ContextProvider.Get(); bool blocklistIsConfigured = sonarrConfig.Enabled && !string.IsNullOrEmpty(config.ContentBlocker.Sonarr.BlocklistPath) || diff --git a/code/UI/src/app/settings/settings-page/settings-page.component.html b/code/UI/src/app/settings/settings-page/settings-page.component.html index a126f52e..4efa4d23 100644 --- a/code/UI/src/app/settings/settings-page/settings-page.component.html +++ b/code/UI/src/app/settings/settings-page/settings-page.component.html @@ -6,25 +6,6 @@

Settings

- -
- -
- - -
- -
- - -
- -
- - -
- -