diff --git a/RMuseum/Migrations/20210111084102_GanjoorMusicCatalogue.Designer.cs b/RMuseum/Migrations/20210111084102_GanjoorMusicCatalogue.Designer.cs new file mode 100644 index 00000000..674bc709 --- /dev/null +++ b/RMuseum/Migrations/20210111084102_GanjoorMusicCatalogue.Designer.cs @@ -0,0 +1,2065 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using RMuseum.DbContext; + +namespace RMuseum.Migrations +{ + [DbContext(typeof(RMuseumDbContext))] + [Migration("20210111084102_GanjoorMusicCatalogue")] + partial class GanjoorMusicCatalogue + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "3.1.3") + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("ClaimType") + .HasColumnType("nvarchar(max)"); + + b.Property("ClaimValue") + .HasColumnType("nvarchar(max)"); + + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("ClaimType") + .HasColumnType("nvarchar(max)"); + + b.Property("ClaimValue") + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("nvarchar(450)"); + + b.Property("ProviderKey") + .HasColumnType("nvarchar(450)"); + + b.Property("ProviderDisplayName") + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("LoginProvider") + .HasColumnType("nvarchar(450)"); + + b.Property("Name") + .HasColumnType("nvarchar(450)"); + + b.Property("Value") + .HasColumnType("nvarchar(max)"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens"); + }); + + modelBuilder.Entity("RMuseum.Models.Artifact.RArtifactItemRecord", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CoverImageIndex") + .HasColumnType("int"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("DescriptionInEnglish") + .HasColumnType("nvarchar(max)"); + + b.Property("FriendlyUrl") + .HasColumnType("nvarchar(450)"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.Property("NameInEnglish") + .HasColumnType("nvarchar(max)"); + + b.Property("Order") + .HasColumnType("int"); + + b.Property("RArtifactMasterRecordId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("RArtifactMasterRecordId", "FriendlyUrl") + .IsUnique() + .HasFilter("[FriendlyUrl] IS NOT NULL"); + + b.HasIndex("RArtifactMasterRecordId", "Order") + .IsUnique(); + + b.ToTable("Items"); + }); + + modelBuilder.Entity("RMuseum.Models.Artifact.RArtifactMasterRecord", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CoverImageId") + .HasColumnType("uniqueidentifier"); + + b.Property("CoverItemIndex") + .HasColumnType("int"); + + b.Property("DateTime") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("DescriptionInEnglish") + .HasColumnType("nvarchar(max)"); + + b.Property("FriendlyUrl") + .HasColumnType("nvarchar(450)"); + + b.Property("ItemCount") + .HasColumnType("int"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.Property("NameInEnglish") + .HasColumnType("nvarchar(max)"); + + b.Property("Status") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CoverImageId"); + + b.HasIndex("FriendlyUrl") + .IsUnique() + .HasFilter("[FriendlyUrl] IS NOT NULL"); + + b.ToTable("Artifacts"); + }); + + modelBuilder.Entity("RMuseum.Models.Artifact.RTag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("FriendlyUrl") + .HasColumnType("nvarchar(450)"); + + b.Property("GlobalValue") + .HasColumnType("bit"); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.Property("NameInEnglish") + .HasColumnType("nvarchar(max)"); + + b.Property("Order") + .HasColumnType("int"); + + b.Property("PluralName") + .HasColumnType("nvarchar(max)"); + + b.Property("PluralNameInEnglish") + .HasColumnType("nvarchar(max)"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("TagType") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("FriendlyUrl"); + + b.ToTable("Tags"); + }); + + modelBuilder.Entity("RMuseum.Models.Artifact.RTagValue", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("FriendlyUrl") + .HasColumnType("nvarchar(450)"); + + b.Property("Order") + .HasColumnType("int"); + + b.Property("RArtifactItemRecordId") + .HasColumnType("uniqueidentifier"); + + b.Property("RArtifactMasterRecordId") + .HasColumnType("uniqueidentifier"); + + b.Property("RTagId") + .HasColumnType("uniqueidentifier"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("Value") + .HasColumnType("nvarchar(max)"); + + b.Property("ValueInEnglish") + .HasColumnType("nvarchar(max)"); + + b.Property("ValueSupplement") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("FriendlyUrl"); + + b.HasIndex("RArtifactItemRecordId"); + + b.HasIndex("RArtifactMasterRecordId"); + + b.HasIndex("RTagId"); + + b.ToTable("TagValues"); + }); + + modelBuilder.Entity("RMuseum.Models.Bookmark.RUserBookmark", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("DateTime") + .HasColumnType("datetime2"); + + b.Property("Note") + .HasColumnType("nvarchar(max)"); + + b.Property("RAppUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("RArtifactItemRecordId") + .HasColumnType("uniqueidentifier"); + + b.Property("RArtifactMasterRecordId") + .HasColumnType("uniqueidentifier"); + + b.Property("RBookmarkType") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("RAppUserId"); + + b.HasIndex("RArtifactItemRecordId"); + + b.HasIndex("RArtifactMasterRecordId"); + + b.ToTable("UserBookmarks"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorCat", b => + { + b.Property("Id") + .HasColumnType("int"); + + b.Property("FullUrl") + .HasColumnType("nvarchar(450)"); + + b.Property("ParentId") + .HasColumnType("int"); + + b.Property("PoetId") + .HasColumnType("int"); + + b.Property("Title") + .HasColumnType("nvarchar(max)"); + + b.Property("UrlSlug") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("FullUrl"); + + b.HasIndex("ParentId"); + + b.HasIndex("PoetId"); + + b.ToTable("GanjoorCategories"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorMetre", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.Property("Rhythm") + .HasColumnType("nvarchar(max)"); + + b.Property("UrlSlug") + .HasColumnType("nvarchar(max)"); + + b.Property("VerseCount") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("GanjoorMetres"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorPage", b => + { + b.Property("Id") + .HasColumnType("int"); + + b.Property("CatId") + .HasColumnType("int"); + + b.Property("FullTitle") + .HasColumnType("nvarchar(max)"); + + b.Property("FullUrl") + .HasColumnType("nvarchar(450)"); + + b.Property("GanjoorPageType") + .HasColumnType("int"); + + b.Property("HtmlText") + .HasColumnType("nvarchar(max)"); + + b.Property("PageOrder") + .HasColumnType("int"); + + b.Property("ParentId") + .HasColumnType("int"); + + b.Property("PoemId") + .HasColumnType("int"); + + b.Property("PoetId") + .HasColumnType("int"); + + b.Property("PostDate") + .HasColumnType("datetime2"); + + b.Property("Published") + .HasColumnType("bit"); + + b.Property("SecondPoetId") + .HasColumnType("int"); + + b.Property("Title") + .HasColumnType("nvarchar(max)"); + + b.Property("UrlSlug") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("CatId"); + + b.HasIndex("FullUrl"); + + b.HasIndex("ParentId"); + + b.HasIndex("PoemId"); + + b.HasIndex("PoetId"); + + b.HasIndex("SecondPoetId"); + + b.ToTable("GanjoorPages"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorPoem", b => + { + b.Property("Id") + .HasColumnType("int"); + + b.Property("CatId") + .HasColumnType("int"); + + b.Property("FullTitle") + .HasColumnType("nvarchar(max)"); + + b.Property("FullUrl") + .HasColumnType("nvarchar(450)"); + + b.Property("GanjoorMetreId") + .HasColumnType("int"); + + b.Property("HtmlText") + .HasColumnType("nvarchar(max)"); + + b.Property("PlainText") + .HasColumnType("nvarchar(max)"); + + b.Property("RhymeLetters") + .HasColumnType("nvarchar(max)"); + + b.Property("SourceName") + .HasColumnType("nvarchar(max)"); + + b.Property("SourceUrlSlug") + .HasColumnType("nvarchar(max)"); + + b.Property("Title") + .HasColumnType("nvarchar(max)"); + + b.Property("UrlSlug") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("CatId"); + + b.HasIndex("FullUrl"); + + b.HasIndex("GanjoorMetreId"); + + b.ToTable("GanjoorPoems"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorPoet", b => + { + b.Property("Id") + .HasColumnType("int"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("GanjoorPoets"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorVerse", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("PoemId") + .HasColumnType("int"); + + b.Property("Text") + .HasColumnType("nvarchar(max)"); + + b.Property("VOrder") + .HasColumnType("int"); + + b.Property("VersePosition") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("PoemId"); + + b.ToTable("GanjoorVerses"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.PoemMusicTrack", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("AlbumName") + .HasColumnType("nvarchar(max)"); + + b.Property("AlbumUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("ApprovalDate") + .HasColumnType("datetime2"); + + b.Property("Approved") + .HasColumnType("bit"); + + b.Property("ArtistName") + .HasColumnType("nvarchar(max)"); + + b.Property("ArtistUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("BrokenLink") + .HasColumnType("bit"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("GanjoorTrackId") + .HasColumnType("int"); + + b.Property("GolhaTrackId") + .HasColumnType("int"); + + b.Property("PoemId") + .HasColumnType("int"); + + b.Property("SingerId") + .HasColumnType("int"); + + b.Property("SuggestedById") + .HasColumnType("uniqueidentifier"); + + b.Property("TrackName") + .HasColumnType("nvarchar(max)"); + + b.Property("TrackType") + .HasColumnType("int"); + + b.Property("TrackUrl") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("GanjoorTrackId"); + + b.HasIndex("GolhaTrackId"); + + b.HasIndex("PoemId"); + + b.HasIndex("SingerId"); + + b.HasIndex("SuggestedById"); + + b.ToTable("PoemMusicTracks"); + }); + + modelBuilder.Entity("RMuseum.Models.GanjoorAudio.Recitation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("AudioArtist") + .HasColumnType("nvarchar(max)"); + + b.Property("AudioArtistUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("AudioOrder") + .HasColumnType("int"); + + b.Property("AudioSrc") + .HasColumnType("nvarchar(max)"); + + b.Property("AudioSrcUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("AudioSyncStatus") + .HasColumnType("int"); + + b.Property("AudioTitle") + .HasColumnType("nvarchar(max)"); + + b.Property("FileLastUpdated") + .HasColumnType("datetime2"); + + b.Property("FileNameWithoutExtension") + .HasColumnType("nvarchar(max)"); + + b.Property("GanjoorAudioId") + .HasColumnType("int"); + + b.Property("GanjoorPostId") + .HasColumnType("int"); + + b.Property("LegacyAudioGuid") + .HasColumnType("uniqueidentifier"); + + b.Property("LocalMp3FilePath") + .HasColumnType("nvarchar(max)"); + + b.Property("LocalXmlFilePath") + .HasColumnType("nvarchar(max)"); + + b.Property("Mp3FileCheckSum") + .HasColumnType("nvarchar(max)"); + + b.Property("Mp3SizeInBytes") + .HasColumnType("int"); + + b.Property("OggSizeInBytes") + .HasColumnType("int"); + + b.Property("OwnerId") + .HasColumnType("uniqueidentifier"); + + b.Property("ReviewDate") + .HasColumnType("datetime2"); + + b.Property("ReviewMsg") + .HasColumnType("nvarchar(max)"); + + b.Property("ReviewStatus") + .HasColumnType("int"); + + b.Property("ReviewerId") + .HasColumnType("uniqueidentifier"); + + b.Property("SoundFilesFolder") + .HasColumnType("nvarchar(max)"); + + b.Property("UploadDate") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("GanjoorPostId"); + + b.HasIndex("OwnerId"); + + b.HasIndex("ReviewerId"); + + b.ToTable("Recitations"); + }); + + modelBuilder.Entity("RMuseum.Models.GanjoorAudio.RecitationPublishingTracker", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("FinishDate") + .HasColumnType("datetime2"); + + b.Property("Finished") + .HasColumnType("bit"); + + b.Property("FirstDbUpdated") + .HasColumnType("bit"); + + b.Property("LastException") + .HasColumnType("nvarchar(max)"); + + b.Property("Mp3FileCopied") + .HasColumnType("bit"); + + b.Property("PoemNarrationId") + .HasColumnType("int"); + + b.Property("SecondDbUpdated") + .HasColumnType("bit"); + + b.Property("StartDate") + .HasColumnType("datetime2"); + + b.Property("XmlFileCopied") + .HasColumnType("bit"); + + b.HasKey("Id"); + + b.HasIndex("PoemNarrationId"); + + b.ToTable("RecitationPublishingTrackers"); + }); + + modelBuilder.Entity("RMuseum.Models.GanjoorAudio.UserRecitationProfile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ArtistName") + .HasColumnType("nvarchar(max)"); + + b.Property("ArtistUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("AudioSrc") + .HasColumnType("nvarchar(max)"); + + b.Property("AudioSrcUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("FileSuffixWithoutDash") + .HasColumnType("nvarchar(max)"); + + b.Property("IsDefault") + .HasColumnType("bit"); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("UserRecitationProfiles"); + }); + + modelBuilder.Entity("RMuseum.Models.GanjoorIntegration.GanjoorLink", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ArtifactId") + .HasColumnType("uniqueidentifier"); + + b.Property("GanjoorPostId") + .HasColumnType("int"); + + b.Property("GanjoorTitle") + .HasColumnType("nvarchar(max)"); + + b.Property("GanjoorUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("ItemId") + .HasColumnType("uniqueidentifier"); + + b.Property("ReviewDate") + .HasColumnType("datetime2"); + + b.Property("ReviewResult") + .HasColumnType("int"); + + b.Property("ReviewerId") + .HasColumnType("uniqueidentifier"); + + b.Property("SuggestedById") + .HasColumnType("uniqueidentifier"); + + b.Property("SuggestionDate") + .HasColumnType("datetime2"); + + b.Property("Synchronized") + .HasColumnType("bit"); + + b.HasKey("Id"); + + b.HasIndex("ArtifactId"); + + b.HasIndex("ItemId"); + + b.HasIndex("ReviewerId"); + + b.HasIndex("SuggestedById"); + + b.ToTable("GanjoorLinks"); + }); + + modelBuilder.Entity("RMuseum.Models.GanjoorIntegration.PinterestLink", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AltText") + .HasColumnType("nvarchar(max)"); + + b.Property("ArtifactId") + .HasColumnType("uniqueidentifier"); + + b.Property("GanjoorPostId") + .HasColumnType("int"); + + b.Property("GanjoorTitle") + .HasColumnType("nvarchar(max)"); + + b.Property("GanjoorUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("ItemId") + .HasColumnType("uniqueidentifier"); + + b.Property("LinkType") + .HasColumnType("int"); + + b.Property("PinterestImageUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("PinterestUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("ReviewDate") + .HasColumnType("datetime2"); + + b.Property("ReviewDesc") + .HasColumnType("nvarchar(max)"); + + b.Property("ReviewResult") + .HasColumnType("int"); + + b.Property("ReviewerId") + .HasColumnType("uniqueidentifier"); + + b.Property("SuggestedById") + .HasColumnType("uniqueidentifier"); + + b.Property("SuggestionDate") + .HasColumnType("datetime2"); + + b.Property("Synchronized") + .HasColumnType("bit"); + + b.HasKey("Id"); + + b.HasIndex("ArtifactId"); + + b.HasIndex("ItemId"); + + b.HasIndex("ReviewerId"); + + b.HasIndex("SuggestedById"); + + b.ToTable("PinterestLinks"); + }); + + modelBuilder.Entity("RMuseum.Models.ImportJob.ImportJob", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ArtifactId") + .HasColumnType("uniqueidentifier"); + + b.Property("EndTime") + .HasColumnType("datetime2"); + + b.Property("Exception") + .HasColumnType("nvarchar(max)"); + + b.Property("FriendlyUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("JobType") + .HasColumnType("int"); + + b.Property("ProgressPercent") + .HasColumnType("decimal(18,2)"); + + b.Property("QueueTime") + .HasColumnType("datetime2"); + + b.Property("ResourceNumber") + .HasColumnType("nvarchar(max)"); + + b.Property("SrcContent") + .HasColumnType("nvarchar(max)"); + + b.Property("SrcUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("StartTime") + .HasColumnType("datetime2"); + + b.Property("Status") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ArtifactId"); + + b.ToTable("ImportJobs"); + }); + + modelBuilder.Entity("RMuseum.Models.MusicCatalogue.GanjoorAlbum", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.Property("SingerId") + .HasColumnType("int"); + + b.Property("Url") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("SingerId"); + + b.ToTable("GanjoorAlbum"); + }); + + modelBuilder.Entity("RMuseum.Models.MusicCatalogue.GanjoorSinger", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Name") + .HasColumnType("nvarchar(450)"); + + b.Property("Url") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("Name"); + + b.ToTable("Singers"); + }); + + modelBuilder.Entity("RMuseum.Models.MusicCatalogue.GanjoorTrack", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("AlbumId") + .HasColumnType("int"); + + b.Property("BlockReason") + .HasColumnType("nvarchar(max)"); + + b.Property("Blocked") + .HasColumnType("bit"); + + b.Property("Name") + .HasColumnType("nvarchar(450)"); + + b.Property("Url") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("AlbumId"); + + b.HasIndex("Name"); + + b.ToTable("MusicTracks"); + }); + + modelBuilder.Entity("RMuseum.Models.MusicCatalogue.GolhaCollection", b => + { + b.Property("Id") + .HasColumnType("int"); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("GolhaCollections"); + }); + + modelBuilder.Entity("RMuseum.Models.MusicCatalogue.GolhaProgram", b => + { + b.Property("Id") + .HasColumnType("int"); + + b.Property("GolhaCollectionId") + .HasColumnType("int"); + + b.Property("Mp3") + .HasColumnType("nvarchar(max)"); + + b.Property("ProgramOrder") + .HasColumnType("int"); + + b.Property("Title") + .HasColumnType("nvarchar(max)"); + + b.Property("Url") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("GolhaCollectionId"); + + b.ToTable("GolhaProgram"); + }); + + modelBuilder.Entity("RMuseum.Models.MusicCatalogue.GolhaTrack", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("BlockReason") + .HasColumnType("nvarchar(max)"); + + b.Property("Blocked") + .HasColumnType("bit"); + + b.Property("GolhaProgramId") + .HasColumnType("int"); + + b.Property("SingerId") + .HasColumnType("int"); + + b.Property("Timing") + .HasColumnType("nvarchar(max)"); + + b.Property("Title") + .HasColumnType("nvarchar(max)"); + + b.Property("TrackNo") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("GolhaProgramId"); + + b.HasIndex("SingerId"); + + b.ToTable("GolhaTrack"); + }); + + modelBuilder.Entity("RMuseum.Models.Note.RUserNote", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("DateTime") + .HasColumnType("datetime2"); + + b.Property("HtmlContent") + .HasColumnType("nvarchar(max)"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("Modified") + .HasColumnType("bit"); + + b.Property("NoteType") + .HasColumnType("int"); + + b.Property("RAppUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("RArtifactItemRecordId") + .HasColumnType("uniqueidentifier"); + + b.Property("RArtifactMasterRecordId") + .HasColumnType("uniqueidentifier"); + + b.Property("ReferenceNoteId") + .HasColumnType("uniqueidentifier"); + + b.Property("Status") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("RAppUserId"); + + b.HasIndex("RArtifactItemRecordId"); + + b.HasIndex("RArtifactMasterRecordId"); + + b.HasIndex("ReferenceNoteId"); + + b.ToTable("UserNotes"); + }); + + modelBuilder.Entity("RMuseum.Models.Notification.RUserNotification", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("DateTime") + .HasColumnType("datetime2"); + + b.Property("HtmlText") + .HasColumnType("nvarchar(max)"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("Subject") + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Notifications"); + }); + + modelBuilder.Entity("RMuseum.Models.UploadSession.UploadSession", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ProcessEndTime") + .HasColumnType("datetime2"); + + b.Property("ProcessProgress") + .HasColumnType("int"); + + b.Property("ProcessStartTime") + .HasColumnType("datetime2"); + + b.Property("SessionType") + .HasColumnType("int"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("UploadEndTime") + .HasColumnType("datetime2"); + + b.Property("UploadStartTime") + .HasColumnType("datetime2"); + + b.Property("UseId") + .HasColumnType("uniqueidentifier"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("UploadSessions"); + }); + + modelBuilder.Entity("RMuseum.Models.UploadSession.UploadSessionFile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ContentDisposition") + .HasColumnType("nvarchar(max)"); + + b.Property("ContentType") + .HasColumnType("nvarchar(max)"); + + b.Property("FileName") + .HasColumnType("nvarchar(max)"); + + b.Property("FilePath") + .HasColumnType("nvarchar(max)"); + + b.Property("Length") + .HasColumnType("bigint"); + + b.Property("MP3FileCheckSum") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.Property("ProcessResult") + .HasColumnType("bit"); + + b.Property("ProcessResultMsg") + .HasColumnType("nvarchar(max)"); + + b.Property("UploadSessionId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("UploadSessionId"); + + b.ToTable("UploadedFiles"); + }); + + modelBuilder.Entity("RSecurityBackend.Models.Audit.Db.REvent", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Duration") + .HasColumnType("int"); + + b.Property("EndDate") + .HasColumnType("datetime2"); + + b.Property("EventType") + .HasColumnType("nvarchar(max)"); + + b.Property("IpAddress") + .HasColumnType("nvarchar(max)"); + + b.Property("JsonData") + .HasColumnType("nvarchar(max)"); + + b.Property("RequestUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("ResponseStatusCode") + .HasColumnType("int"); + + b.Property("StartDate") + .HasColumnType("datetime2"); + + b.Property("UserName") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("AuditLogs"); + }); + + modelBuilder.Entity("RSecurityBackend.Models.Auth.Db.RAppRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("nvarchar(max)"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .HasColumnType("nvarchar(256)") + .HasMaxLength(256); + + b.Property("NormalizedName") + .HasColumnType("nvarchar(256)") + .HasMaxLength(256); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasName("RoleNameIndex") + .HasFilter("[NormalizedName] IS NOT NULL"); + + b.ToTable("AspNetRoles"); + }); + + modelBuilder.Entity("RSecurityBackend.Models.Auth.Db.RAppUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("nvarchar(max)"); + + b.Property("CreateDate") + .HasColumnType("datetime2"); + + b.Property("Email") + .HasColumnType("nvarchar(256)") + .HasMaxLength(256); + + b.Property("EmailConfirmed") + .HasColumnType("bit"); + + b.Property("FirstName") + .HasColumnType("nvarchar(max)"); + + b.Property("LockoutEnabled") + .HasColumnType("bit"); + + b.Property("LockoutEnd") + .HasColumnType("datetimeoffset"); + + b.Property("NormalizedEmail") + .HasColumnType("nvarchar(256)") + .HasMaxLength(256); + + b.Property("NormalizedUserName") + .HasColumnType("nvarchar(256)") + .HasMaxLength(256); + + b.Property("PasswordHash") + .HasColumnType("nvarchar(max)"); + + b.Property("PhoneNumber") + .HasColumnType("nvarchar(max)"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("bit"); + + b.Property("RImageId") + .HasColumnType("uniqueidentifier"); + + b.Property("SecurityStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("SureName") + .HasColumnType("nvarchar(max)"); + + b.Property("TwoFactorEnabled") + .HasColumnType("bit"); + + b.Property("UserName") + .HasColumnType("nvarchar(256)") + .HasMaxLength(256); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasName("UserNameIndex") + .HasFilter("[NormalizedUserName] IS NOT NULL"); + + b.HasIndex("RImageId"); + + b.ToTable("AspNetUsers"); + }); + + modelBuilder.Entity("RSecurityBackend.Models.Auth.Db.RCaptchaImage", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("DateTime") + .HasColumnType("datetime2"); + + b.Property("RImageId") + .HasColumnType("uniqueidentifier"); + + b.Property("Value") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("RImageId"); + + b.ToTable("CaptchaImages"); + }); + + modelBuilder.Entity("RSecurityBackend.Models.Auth.Db.RPermission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("OperationShortName") + .HasColumnType("nvarchar(max)"); + + b.Property("RAppRoleId") + .HasColumnType("uniqueidentifier"); + + b.Property("SecurableItemShortName") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("RAppRoleId"); + + b.ToTable("Permissions"); + }); + + modelBuilder.Entity("RSecurityBackend.Models.Auth.Db.RTemporaryUserSession", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ClientAppName") + .HasColumnType("nvarchar(max)"); + + b.Property("ClientIPAddress") + .HasColumnType("nvarchar(max)"); + + b.Property("Language") + .HasColumnType("nvarchar(max)"); + + b.Property("LastRenewal") + .HasColumnType("datetime2"); + + b.Property("LoginTime") + .HasColumnType("datetime2"); + + b.Property("RAppUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("Token") + .HasColumnType("nvarchar(max)"); + + b.Property("ValidUntil") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("RAppUserId"); + + b.ToTable("Sessions"); + }); + + modelBuilder.Entity("RSecurityBackend.Models.Auth.Db.RVerifyQueueItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ClientAppName") + .HasColumnType("nvarchar(max)"); + + b.Property("ClientIPAddress") + .HasColumnType("nvarchar(max)"); + + b.Property("DateTime") + .HasColumnType("datetime2"); + + b.Property("Email") + .HasColumnType("nvarchar(max)"); + + b.Property("Language") + .HasColumnType("nvarchar(max)"); + + b.Property("PhoneNumber") + .HasColumnType("nvarchar(max)"); + + b.Property("QueueType") + .HasColumnType("int"); + + b.Property("Secret") + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex("Secret") + .IsUnique() + .HasFilter("[Secret] IS NOT NULL"); + + b.ToTable("VerifyQueueItems"); + }); + + modelBuilder.Entity("RSecurityBackend.Models.Generic.Db.RLongRunningJobStatus", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("EndTime") + .HasColumnType("datetime2"); + + b.Property("Exception") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.Property("Progress") + .HasColumnType("float"); + + b.Property("StartTime") + .HasColumnType("datetime2"); + + b.Property("Step") + .HasColumnType("nvarchar(max)"); + + b.Property("Succeeded") + .HasColumnType("bit"); + + b.HasKey("Id"); + + b.ToTable("LongRunningJobs"); + }); + + modelBuilder.Entity("RSecurityBackend.Models.Image.RImage", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ContentType") + .HasColumnType("nvarchar(max)"); + + b.Property("DataTime") + .HasColumnType("datetime2"); + + b.Property("Discriminator") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("FileSizeInBytes") + .HasColumnType("bigint"); + + b.Property("FolderName") + .HasColumnType("nvarchar(max)"); + + b.Property("ImageHeight") + .HasColumnType("int"); + + b.Property("ImageWidth") + .HasColumnType("int"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("OriginalFileName") + .HasColumnType("nvarchar(max)"); + + b.Property("StoredFileName") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("GeneralImages"); + + b.HasDiscriminator("Discriminator").HasValue("RImage"); + }); + + modelBuilder.Entity("RMuseum.Models.Artifact.RPictureFile", b => + { + b.HasBaseType("RSecurityBackend.Models.Image.RImage"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("DescriptionInEnglish") + .HasColumnType("nvarchar(max)"); + + b.Property("LastModifiedMeta") + .HasColumnType("datetime2"); + + b.Property("NormalSizeImageHeight") + .HasColumnType("int"); + + b.Property("NormalSizeImageStoredFileName") + .HasColumnType("nvarchar(max)"); + + b.Property("NormalSizeImageWidth") + .HasColumnType("int"); + + b.Property("Order") + .HasColumnType("int"); + + b.Property("RArtifactItemRecordId") + .HasColumnType("uniqueidentifier"); + + b.Property("SrcUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("ThumbnailImageHeight") + .HasColumnType("int"); + + b.Property("ThumbnailImageStoredFileName") + .HasColumnType("nvarchar(max)"); + + b.Property("ThumbnailImageWidth") + .HasColumnType("int"); + + b.Property("Title") + .HasColumnType("nvarchar(max)"); + + b.Property("TitleInEnglish") + .HasColumnType("nvarchar(max)"); + + b.HasIndex("RArtifactItemRecordId"); + + b.HasDiscriminator().HasValue("RPictureFile"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("RMuseum.Models.Artifact.RArtifactItemRecord", b => + { + b.HasOne("RMuseum.Models.Artifact.RArtifactMasterRecord", null) + .WithMany("Items") + .HasForeignKey("RArtifactMasterRecordId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("RMuseum.Models.Artifact.RArtifactMasterRecord", b => + { + b.HasOne("RMuseum.Models.Artifact.RPictureFile", "CoverImage") + .WithMany() + .HasForeignKey("CoverImageId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("RMuseum.Models.Artifact.RTagValue", b => + { + b.HasOne("RMuseum.Models.Artifact.RArtifactItemRecord", null) + .WithMany("Tags") + .HasForeignKey("RArtifactItemRecordId"); + + b.HasOne("RMuseum.Models.Artifact.RArtifactMasterRecord", null) + .WithMany("Tags") + .HasForeignKey("RArtifactMasterRecordId"); + + b.HasOne("RMuseum.Models.Artifact.RTag", "RTag") + .WithMany() + .HasForeignKey("RTagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("RMuseum.Models.Bookmark.RUserBookmark", b => + { + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "RAppUser") + .WithMany() + .HasForeignKey("RAppUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("RMuseum.Models.Artifact.RArtifactItemRecord", "RArtifactItemRecord") + .WithMany() + .HasForeignKey("RArtifactItemRecordId"); + + b.HasOne("RMuseum.Models.Artifact.RArtifactMasterRecord", "RArtifactMasterRecord") + .WithMany() + .HasForeignKey("RArtifactMasterRecordId"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorCat", b => + { + b.HasOne("RMuseum.Models.Ganjoor.GanjoorCat", "Parent") + .WithMany() + .HasForeignKey("ParentId"); + + b.HasOne("RMuseum.Models.Ganjoor.GanjoorPoet", "Poet") + .WithMany() + .HasForeignKey("PoetId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorPage", b => + { + b.HasOne("RMuseum.Models.Ganjoor.GanjoorCat", "Cat") + .WithMany() + .HasForeignKey("CatId"); + + b.HasOne("RMuseum.Models.Ganjoor.GanjoorPage", "Parent") + .WithMany() + .HasForeignKey("ParentId"); + + b.HasOne("RMuseum.Models.Ganjoor.GanjoorPoem", "Poem") + .WithMany() + .HasForeignKey("PoemId"); + + b.HasOne("RMuseum.Models.Ganjoor.GanjoorPoet", "Poet") + .WithMany() + .HasForeignKey("PoetId"); + + b.HasOne("RMuseum.Models.Ganjoor.GanjoorPoet", "SecondPoet") + .WithMany() + .HasForeignKey("SecondPoetId"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorPoem", b => + { + b.HasOne("RMuseum.Models.Ganjoor.GanjoorCat", "Cat") + .WithMany() + .HasForeignKey("CatId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("RMuseum.Models.Ganjoor.GanjoorMetre", "GanjoorMetre") + .WithMany() + .HasForeignKey("GanjoorMetreId"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorVerse", b => + { + b.HasOne("RMuseum.Models.Ganjoor.GanjoorPoem", "Poem") + .WithMany() + .HasForeignKey("PoemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.PoemMusicTrack", b => + { + b.HasOne("RMuseum.Models.MusicCatalogue.GanjoorTrack", "GanjoorTrack") + .WithMany() + .HasForeignKey("GanjoorTrackId"); + + b.HasOne("RMuseum.Models.MusicCatalogue.GolhaTrack", "GolhaTrack") + .WithMany() + .HasForeignKey("GolhaTrackId"); + + b.HasOne("RMuseum.Models.Ganjoor.GanjoorPoem", "Poem") + .WithMany() + .HasForeignKey("PoemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("RMuseum.Models.MusicCatalogue.GanjoorSinger", "Singer") + .WithMany() + .HasForeignKey("SingerId"); + + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "SuggestedBy") + .WithMany() + .HasForeignKey("SuggestedById"); + }); + + modelBuilder.Entity("RMuseum.Models.GanjoorAudio.Recitation", b => + { + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "Owner") + .WithMany() + .HasForeignKey("OwnerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "Reviewer") + .WithMany() + .HasForeignKey("ReviewerId"); + }); + + modelBuilder.Entity("RMuseum.Models.GanjoorAudio.RecitationPublishingTracker", b => + { + b.HasOne("RMuseum.Models.GanjoorAudio.Recitation", "PoemNarration") + .WithMany() + .HasForeignKey("PoemNarrationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("RMuseum.Models.GanjoorAudio.UserRecitationProfile", b => + { + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("RMuseum.Models.GanjoorIntegration.GanjoorLink", b => + { + b.HasOne("RMuseum.Models.Artifact.RArtifactMasterRecord", "Artifact") + .WithMany() + .HasForeignKey("ArtifactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("RMuseum.Models.Artifact.RArtifactItemRecord", "Item") + .WithMany() + .HasForeignKey("ItemId"); + + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "Reviewer") + .WithMany() + .HasForeignKey("ReviewerId"); + + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "SuggestedBy") + .WithMany() + .HasForeignKey("SuggestedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("RMuseum.Models.GanjoorIntegration.PinterestLink", b => + { + b.HasOne("RMuseum.Models.Artifact.RArtifactMasterRecord", "Artifact") + .WithMany() + .HasForeignKey("ArtifactId"); + + b.HasOne("RMuseum.Models.Artifact.RArtifactItemRecord", "Item") + .WithMany() + .HasForeignKey("ItemId"); + + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "Reviewer") + .WithMany() + .HasForeignKey("ReviewerId"); + + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "SuggestedBy") + .WithMany() + .HasForeignKey("SuggestedById"); + }); + + modelBuilder.Entity("RMuseum.Models.ImportJob.ImportJob", b => + { + b.HasOne("RMuseum.Models.Artifact.RArtifactMasterRecord", "Artifact") + .WithMany() + .HasForeignKey("ArtifactId"); + }); + + modelBuilder.Entity("RMuseum.Models.MusicCatalogue.GanjoorAlbum", b => + { + b.HasOne("RMuseum.Models.MusicCatalogue.GanjoorSinger", "Singer") + .WithMany("Albums") + .HasForeignKey("SingerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("RMuseum.Models.MusicCatalogue.GanjoorTrack", b => + { + b.HasOne("RMuseum.Models.MusicCatalogue.GanjoorAlbum", "Album") + .WithMany("Tracks") + .HasForeignKey("AlbumId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("RMuseum.Models.MusicCatalogue.GolhaProgram", b => + { + b.HasOne("RMuseum.Models.MusicCatalogue.GolhaCollection", "GolhaCollection") + .WithMany("Programs") + .HasForeignKey("GolhaCollectionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("RMuseum.Models.MusicCatalogue.GolhaTrack", b => + { + b.HasOne("RMuseum.Models.MusicCatalogue.GolhaProgram", "GolhaProgram") + .WithMany("Tracks") + .HasForeignKey("GolhaProgramId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("RMuseum.Models.MusicCatalogue.GanjoorSinger", "Singer") + .WithMany() + .HasForeignKey("SingerId"); + }); + + modelBuilder.Entity("RMuseum.Models.Note.RUserNote", b => + { + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "RAppUser") + .WithMany() + .HasForeignKey("RAppUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("RMuseum.Models.Artifact.RArtifactItemRecord", "RArtifactItemRecord") + .WithMany() + .HasForeignKey("RArtifactItemRecordId"); + + b.HasOne("RMuseum.Models.Artifact.RArtifactMasterRecord", "RArtifactMasterRecord") + .WithMany() + .HasForeignKey("RArtifactMasterRecordId"); + + b.HasOne("RMuseum.Models.Note.RUserNote", "ReferenceNote") + .WithMany() + .HasForeignKey("ReferenceNoteId"); + }); + + modelBuilder.Entity("RMuseum.Models.Notification.RUserNotification", b => + { + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("RMuseum.Models.UploadSession.UploadSession", b => + { + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "User") + .WithMany() + .HasForeignKey("UserId"); + }); + + modelBuilder.Entity("RMuseum.Models.UploadSession.UploadSessionFile", b => + { + b.HasOne("RMuseum.Models.UploadSession.UploadSession", null) + .WithMany("UploadedFiles") + .HasForeignKey("UploadSessionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("RSecurityBackend.Models.Auth.Db.RAppUser", b => + { + b.HasOne("RSecurityBackend.Models.Image.RImage", "RImage") + .WithMany() + .HasForeignKey("RImageId"); + }); + + modelBuilder.Entity("RSecurityBackend.Models.Auth.Db.RCaptchaImage", b => + { + b.HasOne("RSecurityBackend.Models.Image.RImage", "RImage") + .WithMany() + .HasForeignKey("RImageId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("RSecurityBackend.Models.Auth.Db.RPermission", b => + { + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppRole", null) + .WithMany("Permissions") + .HasForeignKey("RAppRoleId"); + }); + + modelBuilder.Entity("RSecurityBackend.Models.Auth.Db.RTemporaryUserSession", b => + { + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "RAppUser") + .WithMany() + .HasForeignKey("RAppUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("RMuseum.Models.Artifact.RPictureFile", b => + { + b.HasOne("RMuseum.Models.Artifact.RArtifactItemRecord", null) + .WithMany("Images") + .HasForeignKey("RArtifactItemRecordId"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/RMuseum/Migrations/20210111084102_GanjoorMusicCatalogue.cs b/RMuseum/Migrations/20210111084102_GanjoorMusicCatalogue.cs new file mode 100644 index 00000000..bc35af13 --- /dev/null +++ b/RMuseum/Migrations/20210111084102_GanjoorMusicCatalogue.cs @@ -0,0 +1,276 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace RMuseum.Migrations +{ + public partial class GanjoorMusicCatalogue : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "GolhaCollections", + columns: table => new + { + Id = table.Column(nullable: false), + Name = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_GolhaCollections", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Singers", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Name = table.Column(nullable: true), + Url = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Singers", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "GolhaProgram", + columns: table => new + { + Id = table.Column(nullable: false), + GolhaCollectionId = table.Column(nullable: false), + Title = table.Column(nullable: true), + ProgramOrder = table.Column(nullable: false), + Url = table.Column(nullable: true), + Mp3 = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_GolhaProgram", x => x.Id); + table.ForeignKey( + name: "FK_GolhaProgram_GolhaCollections_GolhaCollectionId", + column: x => x.GolhaCollectionId, + principalTable: "GolhaCollections", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "GanjoorAlbum", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + SingerId = table.Column(nullable: false), + Name = table.Column(nullable: true), + Url = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_GanjoorAlbum", x => x.Id); + table.ForeignKey( + name: "FK_GanjoorAlbum_Singers_SingerId", + column: x => x.SingerId, + principalTable: "Singers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "GolhaTrack", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + GolhaProgramId = table.Column(nullable: false), + TrackNo = table.Column(nullable: false), + Timing = table.Column(nullable: true), + Title = table.Column(nullable: true), + SingerId = table.Column(nullable: true), + Blocked = table.Column(nullable: false), + BlockReason = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_GolhaTrack", x => x.Id); + table.ForeignKey( + name: "FK_GolhaTrack_GolhaProgram_GolhaProgramId", + column: x => x.GolhaProgramId, + principalTable: "GolhaProgram", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_GolhaTrack_Singers_SingerId", + column: x => x.SingerId, + principalTable: "Singers", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "MusicTracks", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + AlbumId = table.Column(nullable: false), + Name = table.Column(nullable: true), + Url = table.Column(nullable: true), + Blocked = table.Column(nullable: false), + BlockReason = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_MusicTracks", x => x.Id); + table.ForeignKey( + name: "FK_MusicTracks_GanjoorAlbum_AlbumId", + column: x => x.AlbumId, + principalTable: "GanjoorAlbum", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "PoemMusicTracks", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + PoemId = table.Column(nullable: false), + TrackType = table.Column(nullable: false), + ArtistName = table.Column(nullable: true), + ArtistUrl = table.Column(nullable: true), + AlbumName = table.Column(nullable: true), + AlbumUrl = table.Column(nullable: true), + TrackName = table.Column(nullable: true), + TrackUrl = table.Column(nullable: true), + GanjoorTrackId = table.Column(nullable: true), + SingerId = table.Column(nullable: true), + GolhaTrackId = table.Column(nullable: true), + Description = table.Column(nullable: true), + Approved = table.Column(nullable: false), + SuggestedById = table.Column(nullable: true), + ApprovalDate = table.Column(nullable: false), + BrokenLink = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_PoemMusicTracks", x => x.Id); + table.ForeignKey( + name: "FK_PoemMusicTracks_MusicTracks_GanjoorTrackId", + column: x => x.GanjoorTrackId, + principalTable: "MusicTracks", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_PoemMusicTracks_GolhaTrack_GolhaTrackId", + column: x => x.GolhaTrackId, + principalTable: "GolhaTrack", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_PoemMusicTracks_GanjoorPoems_PoemId", + column: x => x.PoemId, + principalTable: "GanjoorPoems", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_PoemMusicTracks_Singers_SingerId", + column: x => x.SingerId, + principalTable: "Singers", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_PoemMusicTracks_AspNetUsers_SuggestedById", + column: x => x.SuggestedById, + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateIndex( + name: "IX_GanjoorAlbum_SingerId", + table: "GanjoorAlbum", + column: "SingerId"); + + migrationBuilder.CreateIndex( + name: "IX_GolhaProgram_GolhaCollectionId", + table: "GolhaProgram", + column: "GolhaCollectionId"); + + migrationBuilder.CreateIndex( + name: "IX_GolhaTrack_GolhaProgramId", + table: "GolhaTrack", + column: "GolhaProgramId"); + + migrationBuilder.CreateIndex( + name: "IX_GolhaTrack_SingerId", + table: "GolhaTrack", + column: "SingerId"); + + migrationBuilder.CreateIndex( + name: "IX_MusicTracks_AlbumId", + table: "MusicTracks", + column: "AlbumId"); + + migrationBuilder.CreateIndex( + name: "IX_MusicTracks_Name", + table: "MusicTracks", + column: "Name"); + + migrationBuilder.CreateIndex( + name: "IX_PoemMusicTracks_GanjoorTrackId", + table: "PoemMusicTracks", + column: "GanjoorTrackId"); + + migrationBuilder.CreateIndex( + name: "IX_PoemMusicTracks_GolhaTrackId", + table: "PoemMusicTracks", + column: "GolhaTrackId"); + + migrationBuilder.CreateIndex( + name: "IX_PoemMusicTracks_PoemId", + table: "PoemMusicTracks", + column: "PoemId"); + + migrationBuilder.CreateIndex( + name: "IX_PoemMusicTracks_SingerId", + table: "PoemMusicTracks", + column: "SingerId"); + + migrationBuilder.CreateIndex( + name: "IX_PoemMusicTracks_SuggestedById", + table: "PoemMusicTracks", + column: "SuggestedById"); + + migrationBuilder.CreateIndex( + name: "IX_Singers_Name", + table: "Singers", + column: "Name"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "PoemMusicTracks"); + + migrationBuilder.DropTable( + name: "MusicTracks"); + + migrationBuilder.DropTable( + name: "GolhaTrack"); + + migrationBuilder.DropTable( + name: "GanjoorAlbum"); + + migrationBuilder.DropTable( + name: "GolhaProgram"); + + migrationBuilder.DropTable( + name: "Singers"); + + migrationBuilder.DropTable( + name: "GolhaCollections"); + } + } +} diff --git a/RMuseum/Migrations/RMuseumDbContextModelSnapshot.cs b/RMuseum/Migrations/RMuseumDbContextModelSnapshot.cs index 06b66673..e7e6819a 100644 --- a/RMuseum/Migrations/RMuseumDbContextModelSnapshot.cs +++ b/RMuseum/Migrations/RMuseumDbContextModelSnapshot.cs @@ -549,6 +549,76 @@ namespace RMuseum.Migrations b.ToTable("GanjoorVerses"); }); + modelBuilder.Entity("RMuseum.Models.Ganjoor.PoemMusicTrack", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("AlbumName") + .HasColumnType("nvarchar(max)"); + + b.Property("AlbumUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("ApprovalDate") + .HasColumnType("datetime2"); + + b.Property("Approved") + .HasColumnType("bit"); + + b.Property("ArtistName") + .HasColumnType("nvarchar(max)"); + + b.Property("ArtistUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("BrokenLink") + .HasColumnType("bit"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("GanjoorTrackId") + .HasColumnType("int"); + + b.Property("GolhaTrackId") + .HasColumnType("int"); + + b.Property("PoemId") + .HasColumnType("int"); + + b.Property("SingerId") + .HasColumnType("int"); + + b.Property("SuggestedById") + .HasColumnType("uniqueidentifier"); + + b.Property("TrackName") + .HasColumnType("nvarchar(max)"); + + b.Property("TrackType") + .HasColumnType("int"); + + b.Property("TrackUrl") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("GanjoorTrackId"); + + b.HasIndex("GolhaTrackId"); + + b.HasIndex("PoemId"); + + b.HasIndex("SingerId"); + + b.HasIndex("SuggestedById"); + + b.ToTable("PoemMusicTracks"); + }); + modelBuilder.Entity("RMuseum.Models.GanjoorAudio.Recitation", b => { b.Property("Id") @@ -884,6 +954,157 @@ namespace RMuseum.Migrations b.ToTable("ImportJobs"); }); + modelBuilder.Entity("RMuseum.Models.MusicCatalogue.GanjoorAlbum", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.Property("SingerId") + .HasColumnType("int"); + + b.Property("Url") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("SingerId"); + + b.ToTable("GanjoorAlbum"); + }); + + modelBuilder.Entity("RMuseum.Models.MusicCatalogue.GanjoorSinger", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Name") + .HasColumnType("nvarchar(450)"); + + b.Property("Url") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("Name"); + + b.ToTable("Singers"); + }); + + modelBuilder.Entity("RMuseum.Models.MusicCatalogue.GanjoorTrack", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("AlbumId") + .HasColumnType("int"); + + b.Property("BlockReason") + .HasColumnType("nvarchar(max)"); + + b.Property("Blocked") + .HasColumnType("bit"); + + b.Property("Name") + .HasColumnType("nvarchar(450)"); + + b.Property("Url") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("AlbumId"); + + b.HasIndex("Name"); + + b.ToTable("MusicTracks"); + }); + + modelBuilder.Entity("RMuseum.Models.MusicCatalogue.GolhaCollection", b => + { + b.Property("Id") + .HasColumnType("int"); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("GolhaCollections"); + }); + + modelBuilder.Entity("RMuseum.Models.MusicCatalogue.GolhaProgram", b => + { + b.Property("Id") + .HasColumnType("int"); + + b.Property("GolhaCollectionId") + .HasColumnType("int"); + + b.Property("Mp3") + .HasColumnType("nvarchar(max)"); + + b.Property("ProgramOrder") + .HasColumnType("int"); + + b.Property("Title") + .HasColumnType("nvarchar(max)"); + + b.Property("Url") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("GolhaCollectionId"); + + b.ToTable("GolhaProgram"); + }); + + modelBuilder.Entity("RMuseum.Models.MusicCatalogue.GolhaTrack", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("BlockReason") + .HasColumnType("nvarchar(max)"); + + b.Property("Blocked") + .HasColumnType("bit"); + + b.Property("GolhaProgramId") + .HasColumnType("int"); + + b.Property("SingerId") + .HasColumnType("int"); + + b.Property("Timing") + .HasColumnType("nvarchar(max)"); + + b.Property("Title") + .HasColumnType("nvarchar(max)"); + + b.Property("TrackNo") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("GolhaProgramId"); + + b.HasIndex("SingerId"); + + b.ToTable("GolhaTrack"); + }); + modelBuilder.Entity("RMuseum.Models.Note.RUserNote", b => { b.Property("Id") @@ -1607,6 +1828,31 @@ namespace RMuseum.Migrations .IsRequired(); }); + modelBuilder.Entity("RMuseum.Models.Ganjoor.PoemMusicTrack", b => + { + b.HasOne("RMuseum.Models.MusicCatalogue.GanjoorTrack", "GanjoorTrack") + .WithMany() + .HasForeignKey("GanjoorTrackId"); + + b.HasOne("RMuseum.Models.MusicCatalogue.GolhaTrack", "GolhaTrack") + .WithMany() + .HasForeignKey("GolhaTrackId"); + + b.HasOne("RMuseum.Models.Ganjoor.GanjoorPoem", "Poem") + .WithMany() + .HasForeignKey("PoemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("RMuseum.Models.MusicCatalogue.GanjoorSinger", "Singer") + .WithMany() + .HasForeignKey("SingerId"); + + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "SuggestedBy") + .WithMany() + .HasForeignKey("SuggestedById"); + }); + modelBuilder.Entity("RMuseum.Models.GanjoorAudio.Recitation", b => { b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "Owner") @@ -1687,6 +1933,46 @@ namespace RMuseum.Migrations .HasForeignKey("ArtifactId"); }); + modelBuilder.Entity("RMuseum.Models.MusicCatalogue.GanjoorAlbum", b => + { + b.HasOne("RMuseum.Models.MusicCatalogue.GanjoorSinger", "Singer") + .WithMany("Albums") + .HasForeignKey("SingerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("RMuseum.Models.MusicCatalogue.GanjoorTrack", b => + { + b.HasOne("RMuseum.Models.MusicCatalogue.GanjoorAlbum", "Album") + .WithMany("Tracks") + .HasForeignKey("AlbumId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("RMuseum.Models.MusicCatalogue.GolhaProgram", b => + { + b.HasOne("RMuseum.Models.MusicCatalogue.GolhaCollection", "GolhaCollection") + .WithMany("Programs") + .HasForeignKey("GolhaCollectionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("RMuseum.Models.MusicCatalogue.GolhaTrack", b => + { + b.HasOne("RMuseum.Models.MusicCatalogue.GolhaProgram", "GolhaProgram") + .WithMany("Tracks") + .HasForeignKey("GolhaProgramId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("RMuseum.Models.MusicCatalogue.GanjoorSinger", "Singer") + .WithMany() + .HasForeignKey("SingerId"); + }); + modelBuilder.Entity("RMuseum.Models.Note.RUserNote", b => { b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "RAppUser") diff --git a/RMuseum/RMuseum.xml b/RMuseum/RMuseum.xml index 1be70816..82c93eda 100644 --- a/RMuseum/RMuseum.xml +++ b/RMuseum/RMuseum.xml @@ -3780,6 +3780,16 @@ GanjoorTrack Id + + + singer + + + + + singer id + + GanjoorTrack @@ -3800,6 +3810,29 @@ description + + + approved + + + + + Suggested by user id + + + + + Suggested by user + + + approval user would be extractable from AuditLogs + + + + + approval date + + broken link @@ -6439,6 +6472,28 @@ + + + Music Catalgue Service Implementation + + + + + import catalogue from ganjoor.net MySql db + + + + + + Configuration + + + + + constructor + + + manipulating picture files diff --git a/RMuseum/Services/Implementation/GanjoorService.cs b/RMuseum/Services/Implementation/GanjoorService.cs index ab8c1e7d..df2805d8 100644 --- a/RMuseum/Services/Implementation/GanjoorService.cs +++ b/RMuseum/Services/Implementation/GanjoorService.cs @@ -964,6 +964,7 @@ namespace RMuseum.Services.Implementation try { + using (MySqlConnection connection = new MySqlConnection ( $"server={Configuration.GetSection("AudioMySqlServer")["Server"]};uid={Configuration.GetSection("AudioMySqlServer")["Username"]};pwd={Configuration.GetSection("AudioMySqlServer")["Password"]};database={Configuration.GetSection("AudioMySqlServer")["Database"]};charset=utf8;convert zero datetime=True" @@ -1212,6 +1213,10 @@ namespace RMuseum.Services.Implementation } } + + MusicCatalogueService catalogueService = new MusicCatalogueService(Configuration); + await catalogueService.ImportFromMySql(jobProgressServiceEF, job); + await jobProgressServiceEF.UpdateJob(job.Id, 100, "Finished", true); } catch(Exception jobExp) diff --git a/RMuseum/Services/Implementation/MusicCatalogueService.cs b/RMuseum/Services/Implementation/MusicCatalogueService.cs new file mode 100644 index 00000000..894118fd --- /dev/null +++ b/RMuseum/Services/Implementation/MusicCatalogueService.cs @@ -0,0 +1,236 @@ +using Microsoft.Extensions.Configuration; +using MySql.Data.MySqlClient; +using RMuseum.DbContext; +using RMuseum.Models.MusicCatalogue; +using RSecurityBackend.Models.Generic; +using RSecurityBackend.Models.Generic.Db; +using RSecurityBackend.Services.Implementation; +using System; +using System.Collections.Generic; +using System.Data; +using System.Threading.Tasks; + +namespace RMuseum.Services.Implementation +{ + /// + /// Music Catalgue Service Implementation + /// + public class MusicCatalogueService + { + /// + /// import catalogue from ganjoor.net MySql db + /// + /// + public async Task> ImportFromMySql(LongRunningJobProgressServiceEF jobProgressServiceEF, RLongRunningJobStatus job) + { + try + { + + + using (RMuseumDbContext context = new RMuseumDbContext(Configuration)) //this is long running job, so _context might be already been freed/collected by GC + { + using (MySqlConnection connection = new MySqlConnection + ( + $"server={Configuration.GetSection("AudioMySqlServer")["Server"]};uid={Configuration.GetSection("AudioMySqlServer")["SongsUsername"]};pwd={Configuration.GetSection("AudioMySqlServer")["SongsPassword"]};database={Configuration.GetSection("AudioMySqlServer")["SongsDatabase"]};charset=utf8;convert zero datetime=True" + )) + { + job = (await jobProgressServiceEF.UpdateJob(job.Id, 0, "phase 4 - import golha data - pre open connection")).Result; + + connection.Open(); + + using (MySqlDataAdapter src = new MySqlDataAdapter( + "SELECT col_id, name FROM golha_collections ORDER BY col_id", + connection)) + { + using (DataTable data = new DataTable()) + { + await src.FillAsync(data); + + foreach (DataRow row in data.Rows) + { + + + GolhaCollection collection = new GolhaCollection() + { + Id = int.Parse(row["col_id"].ToString()), + Name = row["name"].ToString(), + Programs = new List() + }; + + job = (await jobProgressServiceEF.UpdateJob(job.Id, 0, $"phase 4 - import golha data - golha_collections: {collection.Id}")).Result; + + + using (MySqlDataAdapter srcPrograms = new MySqlDataAdapter( + $"SELECT program_id, title, progarm_order, url, mp3 FROM golha_programs WHERE col_id = {collection.Id} ORDER BY program_id", + connection)) + { + using (DataTable programData = new DataTable()) + { + await srcPrograms.FillAsync(programData); + + + foreach (DataRow golhaProgram in programData.Rows) + { + GolhaProgram program = new GolhaProgram() + { + Id = int.Parse(golhaProgram["program_id"].ToString()), + Title = golhaProgram["title"].ToString(), + ProgramOrder = int.Parse(golhaProgram["progarm_order"].ToString()), + Url = golhaProgram["url"].ToString(), + Mp3 = golhaProgram["mp3"].ToString(), + Tracks = new List() + }; + + using (MySqlDataAdapter srcTracks = new MySqlDataAdapter( + $"SELECT track_no, timing, title FROM golha_tracks WHERE program_id = {program.Id} ORDER BY track_no", + connection)) + { + using (DataTable trackData = new DataTable()) + { + await srcTracks.FillAsync(trackData); + + foreach (DataRow golhaTrack in trackData.Rows) + { + program.Tracks.Add + ( + new GolhaTrack() + { + TrackNo = int.Parse(golhaTrack["track_no"].ToString()), + Timing = golhaTrack["timing"].ToString(), + Title = golhaTrack["title"].ToString(), + Blocked = false, + } + ); + } + } + + } + collection.Programs.Add(program); + + } + + } + } + context.GolhaCollections.Add(collection); + await context.SaveChangesAsync(); + } + + + + } + } + + + job = (await jobProgressServiceEF.UpdateJob(job.Id, 0, "phase 4 - import singers data")).Result; + + using (MySqlDataAdapter src = new MySqlDataAdapter( + "SELECT artist_id, artist_name, artist_beeptunesurl FROM ganja_artists ORDER BY artist_id", + connection)) + { + using (DataTable data = new DataTable()) + { + await src.FillAsync(data); + + foreach (DataRow row in data.Rows) + { + int artistId = int.Parse(row["artist_id"].ToString()); + + GanjoorSinger singer = new GanjoorSinger() + { + Name = row["artist_name"].ToString(), + Url = row["artist_beeptunesurl"].ToString(), + Albums = new List() + }; + + using (MySqlDataAdapter srcAlbums = new MySqlDataAdapter( + $"SELECT album_id, album_name, album_beeptunesurl FROM ganja_albums WHERE album_artistid = {artistId} ORDER BY album_id", + connection)) + { + using (DataTable dataAlbums = new DataTable()) + { + await srcAlbums.FillAsync(dataAlbums); + + foreach (DataRow rowAlbum in dataAlbums.Rows) + { + + int albumId = int.Parse(rowAlbum["album_id"].ToString()); + + GanjoorAlbum album = new GanjoorAlbum() + { + Name = rowAlbum["album_name"].ToString(), + Url = rowAlbum["album_beeptunesurl"].ToString(), + Tracks = new List() + }; + + using (MySqlDataAdapter srcTracks = new MySqlDataAdapter( + $"SELECT track_name, track_beeptunesurl FROM ganja_tracks WHERE album_id = {albumId} ORDER BY track_id", + connection)) + { + using (DataTable dataTracks = new DataTable()) + { + await srcTracks.FillAsync(dataTracks); + + foreach (DataRow rowTrack in dataTracks.Rows) + { + album.Tracks.Add + ( + new GanjoorTrack() + { + Name = rowTrack["track_name"].ToString(), + Url = rowTrack["track_beeptunesurl"].ToString(), + Blocked = false + } + ); + } + } + } + + singer.Albums.Add(album); + + } + } + } + + + + + context.Singers.Add(singer); + + job = (await jobProgressServiceEF.UpdateJob(job.Id, 0, $"phase 4 - import singers data - {singer.Name}")).Result; + + } + } + } + + job = (await jobProgressServiceEF.UpdateJob(job.Id, 0, "phase 4 - finalizing singers data")).Result; + + await context.SaveChangesAsync(); + } + } + + return new RServiceResult(true); + } + catch(Exception exp) + { + await jobProgressServiceEF.UpdateJob(job.Id, job.Progress, "", false, exp.ToString()); + + return new RServiceResult(false, exp.ToString()); + } + } + + /// + /// Configuration + /// + protected IConfiguration Configuration { get; } + + /// + /// constructor + /// + /// + public MusicCatalogueService(IConfiguration configuration) + { + Configuration = configuration; + } + + } +} diff --git a/RMuseum/appsettings.json b/RMuseum/appsettings.json index f4bf5b7b..a1144062 100644 --- a/RMuseum/appsettings.json +++ b/RMuseum/appsettings.json @@ -40,7 +40,10 @@ "Database": "adab", "2ndDatabase": "audio", "2ndUsername": "audio", - "2ndPassword": "" + "2ndPassword": "", + "SongsDatabase": "golha", + "SongsUsername": "root", + "SongsPassword": "" }, "AudioSFPServer": { "Host": "localhost",