diff --git a/OneShelf.Videos/OneShelf.Videos.Database/Migrations/20240907055250_TelegramUpdatesAdded.Designer.cs b/OneShelf.Videos/OneShelf.Videos.Database/Migrations/20240907055250_TelegramUpdatesAdded.Designer.cs
new file mode 100644
index 00000000..91c1cc8e
--- /dev/null
+++ b/OneShelf.Videos/OneShelf.Videos.Database/Migrations/20240907055250_TelegramUpdatesAdded.Designer.cs
@@ -0,0 +1,605 @@
+//
+using System;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using OneShelf.Videos.Database;
+
+#nullable disable
+
+namespace OneShelf.Videos.Database.Migrations.VideosDatabaseMigrations
+{
+ [DbContext(typeof(VideosDatabase))]
+ [Migration("20240907055250_TelegramUpdatesAdded")]
+ partial class TelegramUpdatesAdded
+ {
+ ///
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "8.0.8")
+ .HasAnnotation("Relational:MaxIdentifierLength", 128);
+
+ SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
+
+ modelBuilder.Entity("OneShelf.Videos.Database.Models.Album", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("Title")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.ToTable("Albums");
+ });
+
+ modelBuilder.Entity("OneShelf.Videos.Database.Models.AlbumConstraint", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("After")
+ .HasColumnType("datetime2");
+
+ b.Property("AlbumId")
+ .HasColumnType("int");
+
+ b.Property("Before")
+ .HasColumnType("datetime2");
+
+ b.Property("Include")
+ .HasColumnType("bit");
+
+ b.Property("IsSquare")
+ .HasColumnType("bit");
+
+ b.Property("MessageSelectedType")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("TopicId")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AlbumId");
+
+ b.HasIndex("TopicId");
+
+ b.ToTable("AlbumConstraints");
+ });
+
+ modelBuilder.Entity("OneShelf.Videos.Database.Models.ChatFolder", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("Root")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("Name")
+ .IsUnique();
+
+ b.ToTable("ChatFolders");
+ });
+
+ modelBuilder.Entity("OneShelf.Videos.Database.Models.InventoryItem", b =>
+ {
+ b.Property("DatabaseInventoryItemId")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("DatabaseInventoryItemId"));
+
+ b.Property("BaseUrl")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ContributorInfoDisplayName")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ContributorInfoProfilePictureBaseUrl")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Description")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("FileName")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Id")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("IsPhoto")
+ .HasColumnType("bit");
+
+ b.Property("IsVideo")
+ .HasColumnType("bit");
+
+ b.Property("MediaMetadataCreationTime")
+ .HasColumnType("datetime2");
+
+ b.Property("MediaMetadataHeight")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("MediaMetadataPhotoApertureFNumber")
+ .HasColumnType("real");
+
+ b.Property("MediaMetadataPhotoCameraMake")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("MediaMetadataPhotoCameraModel")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("MediaMetadataPhotoExposureTime")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("MediaMetadataPhotoFocalLength")
+ .HasColumnType("real");
+
+ b.Property("MediaMetadataPhotoIsoEquivalent")
+ .HasColumnType("int");
+
+ b.Property("MediaMetadataVideoCameraMake")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("MediaMetadataVideoCameraModel")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("MediaMetadataVideoFps")
+ .HasColumnType("float");
+
+ b.Property("MediaMetadataVideoStatus")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("MediaMetadataWidth")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("MimeType")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ProductUrl")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("SyncDate")
+ .HasColumnType("datetime2");
+
+ b.HasKey("DatabaseInventoryItemId");
+
+ b.ToTable("InventoryItems");
+ });
+
+ modelBuilder.Entity("OneShelf.Videos.Database.Models.Json.Chat", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("bigint");
+
+ b.Property("ChatFolderId")
+ .HasColumnType("int");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Type")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ChatFolderId")
+ .IsUnique();
+
+ b.ToTable("Chats");
+ });
+
+ modelBuilder.Entity("OneShelf.Videos.Database.Models.Json.Message", b =>
+ {
+ b.Property("DatabaseMessageId")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("DatabaseMessageId"));
+
+ b.Property("Action")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Actor")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ActorId")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Boosts")
+ .HasColumnType("int");
+
+ b.Property("ChatId")
+ .HasColumnType("bigint");
+
+ b.Property("ContactInformation")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Date")
+ .HasColumnType("datetime2");
+
+ b.Property("DateUnixtime")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Duration")
+ .HasColumnType("int");
+
+ b.Property("DurationSeconds")
+ .HasColumnType("int");
+
+ b.Property("Edited")
+ .HasColumnType("datetime2");
+
+ b.Property("EditedUnixtime")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("File")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("FileName")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ForwardedFrom")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("From")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("FromId")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Height")
+ .HasColumnType("int");
+
+ b.Property("Id")
+ .HasColumnType("int");
+
+ b.Property("InlineBotButtons")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Inviter")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("LiveLocationPeriodSeconds")
+ .HasColumnType("int");
+
+ b.Property("LocationInformation")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("MediaType")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Members")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("MessageId")
+ .HasColumnType("int");
+
+ b.Property("MimeType")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("NewIconEmojiId")
+ .HasColumnType("bigint");
+
+ b.Property("NewTitle")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Performer")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Photo")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Poll")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ReplyToMessageId")
+ .HasColumnType("int");
+
+ b.Property("ReplyToPeerId")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("SavedFrom")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ScheduleDate")
+ .HasColumnType("int");
+
+ b.Property("SelectedType")
+ .ValueGeneratedOnAddOrUpdate()
+ .HasColumnType("nvarchar(max)")
+ .HasComputedColumnSql("case when photo is not null then 'photo' when mimetype like 'video/%' and isnull(mediatype, 'null') in ('video_file', 'null') then 'video' else null end");
+
+ b.Property("StickerEmoji")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Text")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("TextEntities")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Thumbnail")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Title")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("TopicId")
+ .HasColumnType("int");
+
+ b.Property("Type")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ViaBot")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Width")
+ .HasColumnType("int");
+
+ b.HasKey("DatabaseMessageId");
+
+ b.HasIndex("TopicId");
+
+ b.HasIndex("ChatId", "Id")
+ .IsUnique();
+
+ b.ToTable("Messages");
+ });
+
+ modelBuilder.Entity("OneShelf.Videos.Database.Models.TelegramUpdate", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("int");
+
+ b.Property("CreatedOn")
+ .HasColumnType("datetime2");
+
+ b.Property("Json")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.ToTable("TelegramUpdates");
+ });
+
+ modelBuilder.Entity("OneShelf.Videos.Database.Models.Topic", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("ChatId")
+ .HasColumnType("bigint");
+
+ b.Property("OriginalTitle")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("RootMessageIdOr0")
+ .HasColumnType("int");
+
+ b.Property("Title")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ChatId", "RootMessageIdOr0")
+ .IsUnique();
+
+ b.ToTable("Topics");
+ });
+
+ modelBuilder.Entity("OneShelf.Videos.Database.Models.UploadedAlbum", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("AlbumId")
+ .HasColumnType("int");
+
+ b.Property("GoogleAlbumId")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AlbumId")
+ .IsUnique();
+
+ b.ToTable("UploadedAlbums");
+ });
+
+ modelBuilder.Entity("OneShelf.Videos.Database.Models.UploadedItem", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("ChatId")
+ .HasColumnType("bigint");
+
+ b.Property("CreatedOn")
+ .HasColumnType("datetime2");
+
+ b.Property("FileNameTimestamp")
+ .HasColumnType("datetime2");
+
+ b.Property("Json")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("MediaItemId")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("MediaItemIsPhoto")
+ .HasColumnType("bit");
+
+ b.Property("MediaItemIsVideo")
+ .HasColumnType("bit");
+
+ b.Property("MediaItemMetadataCreationTime")
+ .HasColumnType("datetime2");
+
+ b.Property("MediaItemMimeType")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("MediaItemSyncDate")
+ .HasColumnType("datetime2");
+
+ b.Property("MessageId")
+ .HasColumnType("int");
+
+ b.Property("Status")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("StatusCode")
+ .HasColumnType("int");
+
+ b.Property("StatusMessage")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("TelegramPublishedOn")
+ .HasColumnType("datetime2");
+
+ b.HasKey("Id");
+
+ b.ToTable("UploadedItems");
+ });
+
+ modelBuilder.Entity("OneShelf.Videos.Database.Models.AlbumConstraint", b =>
+ {
+ b.HasOne("OneShelf.Videos.Database.Models.Album", "Album")
+ .WithMany("Constraints")
+ .HasForeignKey("AlbumId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("OneShelf.Videos.Database.Models.Topic", "Topic")
+ .WithMany("AlbumConstraints")
+ .HasForeignKey("TopicId");
+
+ b.Navigation("Album");
+
+ b.Navigation("Topic");
+ });
+
+ modelBuilder.Entity("OneShelf.Videos.Database.Models.Json.Chat", b =>
+ {
+ b.HasOne("OneShelf.Videos.Database.Models.ChatFolder", "ChatFolder")
+ .WithOne("Chat")
+ .HasForeignKey("OneShelf.Videos.Database.Models.Json.Chat", "ChatFolderId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("ChatFolder");
+ });
+
+ modelBuilder.Entity("OneShelf.Videos.Database.Models.Json.Message", b =>
+ {
+ b.HasOne("OneShelf.Videos.Database.Models.Json.Chat", "Chat")
+ .WithMany("Messages")
+ .HasForeignKey("ChatId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("OneShelf.Videos.Database.Models.Topic", "Topic")
+ .WithMany("Messages")
+ .HasForeignKey("TopicId");
+
+ b.Navigation("Chat");
+
+ b.Navigation("Topic");
+ });
+
+ modelBuilder.Entity("OneShelf.Videos.Database.Models.Topic", b =>
+ {
+ b.HasOne("OneShelf.Videos.Database.Models.Json.Chat", "Chat")
+ .WithMany()
+ .HasForeignKey("ChatId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Chat");
+ });
+
+ modelBuilder.Entity("OneShelf.Videos.Database.Models.UploadedAlbum", b =>
+ {
+ b.HasOne("OneShelf.Videos.Database.Models.Album", "Album")
+ .WithOne("UploadedAlbum")
+ .HasForeignKey("OneShelf.Videos.Database.Models.UploadedAlbum", "AlbumId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Album");
+ });
+
+ modelBuilder.Entity("OneShelf.Videos.Database.Models.Album", b =>
+ {
+ b.Navigation("Constraints");
+
+ b.Navigation("UploadedAlbum");
+ });
+
+ modelBuilder.Entity("OneShelf.Videos.Database.Models.ChatFolder", b =>
+ {
+ b.Navigation("Chat");
+ });
+
+ modelBuilder.Entity("OneShelf.Videos.Database.Models.Json.Chat", b =>
+ {
+ b.Navigation("Messages");
+ });
+
+ modelBuilder.Entity("OneShelf.Videos.Database.Models.Topic", b =>
+ {
+ b.Navigation("AlbumConstraints");
+
+ b.Navigation("Messages");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/OneShelf.Videos/OneShelf.Videos.Database/Migrations/20240907055250_TelegramUpdatesAdded.cs b/OneShelf.Videos/OneShelf.Videos.Database/Migrations/20240907055250_TelegramUpdatesAdded.cs
new file mode 100644
index 00000000..4b1fae36
--- /dev/null
+++ b/OneShelf.Videos/OneShelf.Videos.Database/Migrations/20240907055250_TelegramUpdatesAdded.cs
@@ -0,0 +1,35 @@
+using System;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace OneShelf.Videos.Database.Migrations.VideosDatabaseMigrations
+{
+ ///
+ public partial class TelegramUpdatesAdded : Migration
+ {
+ ///
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.CreateTable(
+ name: "TelegramUpdates",
+ columns: table => new
+ {
+ Id = table.Column(type: "int", nullable: false),
+ CreatedOn = table.Column(type: "datetime2", nullable: false),
+ Json = table.Column(type: "nvarchar(max)", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_TelegramUpdates", x => x.Id);
+ });
+ }
+
+ ///
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropTable(
+ name: "TelegramUpdates");
+ }
+ }
+}
diff --git a/OneShelf.Videos/OneShelf.Videos.Database/Migrations/VideosDatabaseModelSnapshot.cs b/OneShelf.Videos/OneShelf.Videos.Database/Migrations/VideosDatabaseModelSnapshot.cs
index 2748334b..38ceb2cc 100644
--- a/OneShelf.Videos/OneShelf.Videos.Database/Migrations/VideosDatabaseModelSnapshot.cs
+++ b/OneShelf.Videos/OneShelf.Videos.Database/Migrations/VideosDatabaseModelSnapshot.cs
@@ -377,6 +377,23 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.ToTable("Messages");
});
+ modelBuilder.Entity("OneShelf.Videos.Database.Models.TelegramUpdate", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("int");
+
+ b.Property("CreatedOn")
+ .HasColumnType("datetime2");
+
+ b.Property("Json")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.ToTable("TelegramUpdates");
+ });
+
modelBuilder.Entity("OneShelf.Videos.Database.Models.Topic", b =>
{
b.Property("Id")