Usenet streaming with a WebDAV server and a SABnzbd-compatible API
C#
Added BlobCleanupItems table.
nzbdav-devadabf6dee4dc
diff --git a/backend/Database/DavDatabaseContext.cs b/backend/Database/DavDatabaseContext.csindex 3a7a2009..b518fe7d 100644--- a/backend/Database/DavDatabaseContext.cs+++ b/backend/Database/DavDatabaseContext.cs@@ -30,6 +30,7 @@ public sealed class DavDatabaseContext() : DbContext(Options.Value)public DbSet<HealthCheckResult> HealthCheckResults => Set<HealthCheckResult>();public DbSet<HealthCheckStat> HealthCheckStats => Set<HealthCheckStat>();public DbSet<ConfigItem> ConfigItems => Set<ConfigItem>();+ public DbSet<BlobCleanupItem> BlobCleanupItems => Set<BlobCleanupItem>();// tablesprotected override void OnModelCreating(ModelBuilder b)@@ -405,5 +406,15 @@ public sealed class DavDatabaseContext() : DbContext(Options.Value)e.Property(i => i.ConfigValue).IsRequired();});++ // BlobCleanupItem+ b.Entity<BlobCleanupItem>(e =>+ {+ e.ToTable("BlobCleanupItems");+ e.HasKey(i => i.Id);++ e.Property(i => i.Id)+ .ValueGeneratedNever();+ });}}\ No newline at end of filediff --git a/backend/Database/Migrations/20260108054841_Add-BlobCleanupItems-Table.Designer.cs b/backend/Database/Migrations/20260108054841_Add-BlobCleanupItems-Table.Designer.csnew file mode 100644index 00000000..25ccd9ad--- /dev/null+++ b/backend/Database/Migrations/20260108054841_Add-BlobCleanupItems-Table.Designer.cs@@ -0,0 +1,396 @@+// <auto-generated />+using System;+using Microsoft.EntityFrameworkCore;+using Microsoft.EntityFrameworkCore.Infrastructure;+using Microsoft.EntityFrameworkCore.Migrations;+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;+using NzbWebDAV.Database;++#nullable disable++namespace NzbWebDAV.Database.Migrations+{+ [DbContext(typeof(DavDatabaseContext))]+ [Migration("20260108054841_Add-BlobCleanupItems-Table")]+ partial class AddBlobCleanupItemsTable+ {+ /// <inheritdoc />+ protected override void BuildTargetModel(ModelBuilder modelBuilder)+ {+#pragma warning disable 612, 618+ modelBuilder.HasAnnotation("ProductVersion", "9.0.4");++ modelBuilder.Entity("NzbWebDAV.Database.Models.Account", b =>+ {+ b.Property<int>("Type")+ .HasColumnType("INTEGER");++ b.Property<string>("Username")+ .HasMaxLength(255)+ .HasColumnType("TEXT");++ b.Property<string>("PasswordHash")+ .IsRequired()+ .HasColumnType("TEXT");++ b.Property<string>("RandomSalt")+ .IsRequired()+ .HasColumnType("TEXT");++ b.HasKey("Type", "Username");++ b.ToTable("Accounts", (string)null);+ });++ modelBuilder.Entity("NzbWebDAV.Database.Models.BlobCleanupItem", b =>+ {+ b.Property<Guid>("Id")+ .HasColumnType("TEXT");++ b.HasKey("Id");++ b.ToTable("BlobCleanupItems", (string)null);+ });++ modelBuilder.Entity("NzbWebDAV.Database.Models.ConfigItem", b =>+ {+ b.Property<string>("ConfigName")+ .HasColumnType("TEXT");++ b.Property<string>("ConfigValue")+ .IsRequired()+ .HasColumnType("TEXT");++ b.HasKey("ConfigName");++ b.ToTable("ConfigItems", (string)null);+ });++ modelBuilder.Entity("NzbWebDAV.Database.Models.DavItem", b =>+ {+ b.Property<Guid>("Id")+ .HasColumnType("TEXT");++ b.Property<DateTime>("CreatedAt")+ .HasColumnType("TEXT");++ b.Property<long?>("FileSize")+ .HasColumnType("INTEGER");++ b.Property<string>("IdPrefix")+ .IsRequired()+ .HasColumnType("TEXT");++ b.Property<long?>("LastHealthCheck")+ .HasColumnType("INTEGER");++ b.Property<string>("Name")+ .IsRequired()+ .HasMaxLength(255)+ .HasColumnType("TEXT");++ b.Property<long?>("NextHealthCheck")+ .HasColumnType("INTEGER");++ b.Property<Guid?>("ParentId")+ .HasColumnType("TEXT");++ b.Property<string>("Path")+ .IsRequired()+ .HasColumnType("TEXT");++ b.Property<long?>("ReleaseDate")+ .HasColumnType("INTEGER");++ b.Property<int>("Type")+ .HasColumnType("INTEGER");++ b.HasKey("Id");++ b.HasIndex("IdPrefix", "Type");++ b.HasIndex("ParentId", "Name")+ .IsUnique();++ b.HasIndex("Type", "NextHealthCheck", "ReleaseDate", "Id");++ b.ToTable("DavItems", (string)null);+ });++ modelBuilder.Entity("NzbWebDAV.Database.Models.DavMultipartFile", b =>+ {+ b.Property<Guid>("Id")+ .HasColumnType("TEXT");++ b.Property<string>("Metadata")+ .IsRequired()+ .HasColumnType("TEXT");++ b.HasKey("Id");++ b.ToTable("DavMultipartFiles", (string)null);+ });++ modelBuilder.Entity("NzbWebDAV.Database.Models.DavNzbFile", b =>+ {+ b.Property<Guid>("Id")+ .HasColumnType("TEXT");++ b.Property<string>("SegmentIds")+ .IsRequired()+ .HasColumnType("TEXT");++ b.HasKey("Id");++ b.ToTable("DavNzbFiles", (string)null);+ });++ modelBuilder.Entity("NzbWebDAV.Database.Models.DavRarFile", b =>+ {+ b.Property<Guid>("Id")+ .HasColumnType("TEXT");++ b.Property<string>("RarParts")+ .IsRequired()+ .HasColumnType("TEXT");++ b.HasKey("Id");++ b.ToTable("DavRarFiles", (string)null);+ });++ modelBuilder.Entity("NzbWebDAV.Database.Models.HealthCheckResult", b =>+ {+ b.Property<Guid>("Id")+ .HasColumnType("TEXT");++ b.Property<long>("CreatedAt")+ .HasColumnType("INTEGER");++ b.Property<Guid>("DavItemId")+ .HasColumnType("TEXT");++ b.Property<string>("Message")+ .HasColumnType("TEXT");++ b.Property<string>("Path")+ .IsRequired()+ .HasColumnType("TEXT");++ b.Property<int>("RepairStatus")+ .HasColumnType("INTEGER");++ b.Property<int>("Result")+ .HasColumnType("INTEGER");++ b.HasKey("Id");++ b.HasIndex("CreatedAt");++ b.HasIndex("DavItemId")+ .HasFilter("\"RepairStatus\" = 3");++ b.HasIndex("Result", "RepairStatus", "CreatedAt");++ b.ToTable("HealthCheckResults", (string)null);+ });++ modelBuilder.Entity("NzbWebDAV.Database.Models.HealthCheckStat", b =>+ {+ b.Property<long>("DateStartInclusive")+ .HasColumnType("INTEGER");++ b.Property<long>("DateEndExclusive")+ .HasColumnType("INTEGER");++ b.Property<int>("Result")+ .HasColumnType("INTEGER");++ b.Property<int>("RepairStatus")+ .HasColumnType("INTEGER");++ b.Property<int>("Count")+ .HasColumnType("INTEGER");++ b.HasKey("DateStartInclusive", "DateEndExclusive", "Result", "RepairStatus");++ b.ToTable("HealthCheckStats", (string)null);+ });++ modelBuilder.Entity("NzbWebDAV.Database.Models.HistoryItem", b =>+ {+ b.Property<Guid>("Id")+ .HasColumnType("TEXT");++ b.Property<string>("Category")+ .IsRequired()+ .HasColumnType("TEXT");++ b.Property<DateTime>("CreatedAt")+ .HasColumnType("TEXT");++ b.Property<Guid?>("DownloadDirId")+ .HasColumnType("TEXT");++ b.Property<int>("DownloadStatus")+ .HasColumnType("INTEGER");++ b.Property<int>("DownloadTimeSeconds")+ .HasColumnType("INTEGER");++ b.Property<string>("FailMessage")+ .HasColumnType("TEXT");++ b.Property<string>("FileName")+ .IsRequired()+ .HasColumnType("TEXT");++ b.Property<string>("JobName")+ .IsRequired()+ .HasColumnType("TEXT");++ b.Property<long>("TotalSegmentBytes")+ .HasColumnType("INTEGER");++ b.HasKey("Id");++ b.HasIndex("Category");++ b.HasIndex("CreatedAt");++ b.HasIndex("Category", "CreatedAt");++ b.HasIndex("Category", "DownloadDirId");++ b.ToTable("HistoryItems", (string)null);+ });++ modelBuilder.Entity("NzbWebDAV.Database.Models.QueueItem", b =>+ {+ b.Property<Guid>("Id")+ .HasColumnType("TEXT");++ b.Property<string>("Category")+ .IsRequired()+ .HasColumnType("TEXT");++ b.Property<DateTime>("CreatedAt")+ .HasColumnType("TEXT");++ b.Property<string>("FileName")+ .IsRequired()+ .HasColumnType("TEXT");++ b.Property<string>("JobName")+ .IsRequired()+ .HasColumnType("TEXT");++ b.Property<long>("NzbFileSize")+ .HasColumnType("INTEGER");++ b.Property<DateTime?>("PauseUntil")+ .HasColumnType("TEXT");++ b.Property<int>("PostProcessing")+ .HasColumnType("INTEGER");++ b.Property<int>("Priority")+ .HasColumnType("INTEGER");++ b.Property<long>("TotalSegmentBytes")+ .HasColumnType("INTEGER");++ b.HasKey("Id");++ b.HasIndex("Category");++ b.HasIndex("CreatedAt");++ b.HasIndex("FileName")+ .IsUnique();++ b.HasIndex("Priority");++ b.HasIndex("Priority", "CreatedAt");++ b.HasIndex("Category", "Priority", "CreatedAt");++ b.ToTable("QueueItems", (string)null);+ });++ modelBuilder.Entity("NzbWebDAV.Database.Models.QueueNzbContents", b =>+ {+ b.Property<Guid>("Id")+ .HasColumnType("TEXT");++ b.Property<string>("NzbContents")+ .IsRequired()+ .HasColumnType("TEXT");++ b.HasKey("Id");++ b.ToTable("QueueNzbContents", (string)null);+ });++ modelBuilder.Entity("NzbWebDAV.Database.Models.DavItem", b =>+ {+ b.HasOne("NzbWebDAV.Database.Models.DavItem", "Parent")+ .WithMany("Children")+ .HasForeignKey("ParentId")+ .OnDelete(DeleteBehavior.Cascade);++ b.Navigation("Parent");+ });++ modelBuilder.Entity("NzbWebDAV.Database.Models.DavMultipartFile", b =>+ {+ b.HasOne("NzbWebDAV.Database.Models.DavItem", "DavItem")+ .WithOne()+ .HasForeignKey("NzbWebDAV.Database.Models.DavMultipartFile", "Id")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("DavItem");+ });++ modelBuilder.Entity("NzbWebDAV.Database.Models.DavNzbFile", b =>+ {+ b.HasOne("NzbWebDAV.Database.Models.DavItem", "DavItem")+ .WithOne()+ .HasForeignKey("NzbWebDAV.Database.Models.DavNzbFile", "Id")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("DavItem");+ });++ modelBuilder.Entity("NzbWebDAV.Database.Models.DavRarFile", b =>+ {+ b.HasOne("NzbWebDAV.Database.Models.DavItem", "DavItem")+ .WithOne()+ .HasForeignKey("NzbWebDAV.Database.Models.DavRarFile", "Id")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("DavItem");+ });++ modelBuilder.Entity("NzbWebDAV.Database.Models.QueueNzbContents", b =>+ {+ b.HasOne("NzbWebDAV.Database.Models.QueueItem", "QueueItem")+ .WithOne()+ .HasForeignKey("NzbWebDAV.Database.Models.QueueNzbContents", "Id")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("QueueItem");+ });++ modelBuilder.Entity("NzbWebDAV.Database.Models.DavItem", b =>+ {+ b.Navigation("Children");+ });+#pragma warning restore 612, 618+ }+ }+}diff --git a/backend/Database/Migrations/20260108054841_Add-BlobCleanupItems-Table.cs b/backend/Database/Migrations/20260108054841_Add-BlobCleanupItems-Table.csnew file mode 100644index 00000000..849a7d8f--- /dev/null+++ b/backend/Database/Migrations/20260108054841_Add-BlobCleanupItems-Table.cs@@ -0,0 +1,33 @@+using System;+using Microsoft.EntityFrameworkCore.Migrations;++#nullable disable++namespace NzbWebDAV.Database.Migrations+{+ /// <inheritdoc />+ public partial class AddBlobCleanupItemsTable : Migration+ {+ /// <inheritdoc />+ protected override void Up(MigrationBuilder migrationBuilder)+ {+ migrationBuilder.CreateTable(+ name: "BlobCleanupItems",+ columns: table => new+ {+ Id = table.Column<Guid>(type: "TEXT", nullable: false)+ },+ constraints: table =>+ {+ table.PrimaryKey("PK_BlobCleanupItems", x => x.Id);+ });+ }++ /// <inheritdoc />+ protected override void Down(MigrationBuilder migrationBuilder)+ {+ migrationBuilder.DropTable(+ name: "BlobCleanupItems");+ }+ }+}diff --git a/backend/Database/Migrations/DavDatabaseContextModelSnapshot.cs b/backend/Database/Migrations/DavDatabaseContextModelSnapshot.csindex ae7ae249..41ee8c55 100644--- a/backend/Database/Migrations/DavDatabaseContextModelSnapshot.cs+++ b/backend/Database/Migrations/DavDatabaseContextModelSnapshot.cs@@ -39,6 +39,16 @@ namespace NzbWebDAV.Database.Migrationsb.ToTable("Accounts", (string)null);});+ modelBuilder.Entity("NzbWebDAV.Database.Models.BlobCleanupItem", b =>+ {+ b.Property<Guid>("Id")+ .HasColumnType("TEXT");++ b.HasKey("Id");++ b.ToTable("BlobCleanupItems", (string)null);+ });+modelBuilder.Entity("NzbWebDAV.Database.Models.ConfigItem", b =>{b.Property<string>("ConfigName")diff --git a/backend/Database/Models/BlobCleanupItem.cs b/backend/Database/Models/BlobCleanupItem.csnew file mode 100644index 00000000..d5e5a1a0--- /dev/null+++ b/backend/Database/Models/BlobCleanupItem.cs@@ -0,0 +1,6 @@+namespace NzbWebDAV.Database.Models;++public class BlobCleanupItem+{+ public Guid Id { get; set; }+}