diff --git a/RMuseum/Migrations/20201023091130_GanjoorCachingFields.Designer.cs b/RMuseum/Migrations/20201023091130_GanjoorCachingFields.Designer.cs index 82220cb4..7054c1a8 100644 --- a/RMuseum/Migrations/20201023091130_GanjoorCachingFields.Designer.cs +++ b/RMuseum/Migrations/20201023091130_GanjoorCachingFields.Designer.cs @@ -343,9 +343,6 @@ namespace RMuseum.Migrations b.Property("Id") .HasColumnType("int"); - b.Property("CachedContent") - .HasColumnType("nvarchar(max)"); - b.Property("FullUrl") .HasColumnType("nvarchar(max)"); @@ -375,9 +372,6 @@ namespace RMuseum.Migrations b.Property("Id") .HasColumnType("int"); - b.Property("CachedContent") - .HasColumnType("nvarchar(max)"); - b.Property("CatId") .HasColumnType("int"); diff --git a/RMuseum/Migrations/20201023091130_GanjoorCachingFields.cs b/RMuseum/Migrations/20201023091130_GanjoorCachingFields.cs index 13d97862..09c6a9a8 100644 --- a/RMuseum/Migrations/20201023091130_GanjoorCachingFields.cs +++ b/RMuseum/Migrations/20201023091130_GanjoorCachingFields.cs @@ -6,21 +6,11 @@ namespace RMuseum.Migrations { protected override void Up(MigrationBuilder migrationBuilder) { - migrationBuilder.AddColumn( - name: "CachedContent", - table: "GanjoorPoems", - nullable: true); - migrationBuilder.AddColumn( name: "FullUrl", table: "GanjoorPoems", nullable: true); - migrationBuilder.AddColumn( - name: "CachedContent", - table: "GanjoorCategories", - nullable: true); - migrationBuilder.AddColumn( name: "FullUrl", table: "GanjoorCategories", @@ -29,18 +19,10 @@ namespace RMuseum.Migrations protected override void Down(MigrationBuilder migrationBuilder) { - migrationBuilder.DropColumn( - name: "CachedContent", - table: "GanjoorPoems"); - migrationBuilder.DropColumn( name: "FullUrl", table: "GanjoorPoems"); - migrationBuilder.DropColumn( - name: "CachedContent", - table: "GanjoorCategories"); - migrationBuilder.DropColumn( name: "FullUrl", table: "GanjoorCategories"); diff --git a/RMuseum/Migrations/20201023091559_GanjoorIndices.Designer.cs b/RMuseum/Migrations/20201023091559_GanjoorIndices.Designer.cs index 9c51f19f..4a2878f9 100644 --- a/RMuseum/Migrations/20201023091559_GanjoorIndices.Designer.cs +++ b/RMuseum/Migrations/20201023091559_GanjoorIndices.Designer.cs @@ -343,9 +343,6 @@ namespace RMuseum.Migrations b.Property("Id") .HasColumnType("int"); - b.Property("CachedContent") - .HasColumnType("nvarchar(max)"); - b.Property("FullUrl") .HasColumnType("nvarchar(450)"); @@ -377,9 +374,6 @@ namespace RMuseum.Migrations b.Property("Id") .HasColumnType("int"); - b.Property("CachedContent") - .HasColumnType("nvarchar(max)"); - b.Property("CatId") .HasColumnType("int"); diff --git a/RMuseum/Migrations/RMuseumDbContextModelSnapshot.cs b/RMuseum/Migrations/RMuseumDbContextModelSnapshot.cs index 9e023a27..5a29806c 100644 --- a/RMuseum/Migrations/RMuseumDbContextModelSnapshot.cs +++ b/RMuseum/Migrations/RMuseumDbContextModelSnapshot.cs @@ -340,10 +340,7 @@ namespace RMuseum.Migrations { b.Property("Id") .HasColumnType("int"); - - b.Property("CachedContent") - .HasColumnType("nvarchar(max)"); - + b.Property("FullUrl") .HasColumnType("nvarchar(450)"); @@ -374,10 +371,7 @@ namespace RMuseum.Migrations { b.Property("Id") .HasColumnType("int"); - - b.Property("CachedContent") - .HasColumnType("nvarchar(max)"); - + b.Property("CatId") .HasColumnType("int"); diff --git a/RMuseum/Models/Ganjoor/GanjoorCat.cs b/RMuseum/Models/Ganjoor/GanjoorCat.cs index 247ac932..70dfe546 100644 --- a/RMuseum/Models/Ganjoor/GanjoorCat.cs +++ b/RMuseum/Models/Ganjoor/GanjoorCat.cs @@ -48,10 +48,5 @@ namespace RMuseum.Models.Ganjoor /// sample: /hafez/ghazal /// public string FullUrl { get; set; } - - /// - /// Cached Content to be used on UI - /// - public string CachedContent { get; set; } } } diff --git a/RMuseum/Models/Ganjoor/GanjoorPoem.cs b/RMuseum/Models/Ganjoor/GanjoorPoem.cs index c21d2a84..327ed200 100644 --- a/RMuseum/Models/Ganjoor/GanjoorPoem.cs +++ b/RMuseum/Models/Ganjoor/GanjoorPoem.cs @@ -43,10 +43,5 @@ namespace RMuseum.Models.Ganjoor /// sample: /hafez/ghazal/sh1 /// public string FullUrl { get; set; } - - /// - /// Cached Content to be used on UI - /// - public string CachedContent { get; set; } } } diff --git a/RMuseum/RMuseum.xml b/RMuseum/RMuseum.xml index f52e5ea5..4b6c648a 100644 --- a/RMuseum/RMuseum.xml +++ b/RMuseum/RMuseum.xml @@ -2807,11 +2807,6 @@ sample: /hafez/ghazal - - - Cached Content to be used on UI - - Ganjoor Poem @@ -2852,11 +2847,6 @@ sample: /hafez/ghazal/sh1 - - - Cached Content to be used on UI - - Ganjoor Poet diff --git a/RMuseum/Services/Implementation/AudioNarrationService.cs b/RMuseum/Services/Implementation/AudioNarrationService.cs index 38d781ec..50cd21b7 100644 --- a/RMuseum/Services/Implementation/AudioNarrationService.cs +++ b/RMuseum/Services/Implementation/AudioNarrationService.cs @@ -39,27 +39,26 @@ namespace RMuseum.Services.Implementation try { var source = - - _context.AudioFiles + from audio in _context.AudioFiles .Include(a => a.Owner) - .Where(a => + .Where(a => (filteredUserId == Guid.Empty || a.OwnerId == filteredUserId) && (status == AudioReviewStatus.All || a.ReviewStatus == status) ) .OrderByDescending(a => a.UploadDate) - .AsQueryable(); + join poem in _context.GanjoorPoems + on audio.GanjoorPostId equals poem.Id + select new PoemNarrationViewModel(audio); - (PaginationMetadata PagingMeta, PoemNarration[] Items) paginatedResult = - await QueryablePaginator.Paginate(source, paging); + - List res = new List(); - foreach(PoemNarration audio in paginatedResult.Items) - { - res.Add(new PoemNarrationViewModel(audio)); - } + (PaginationMetadata PagingMeta, PoemNarrationViewModel[] Items) paginatedResult = + await QueryablePaginator.Paginate(source, paging); - return new RServiceResult<(PaginationMetadata PagingMeta, PoemNarrationViewModel[] Items)>((paginatedResult.PagingMeta, res.ToArray())); + + + return new RServiceResult<(PaginationMetadata PagingMeta, PoemNarrationViewModel[] Items)>((paginatedResult.PagingMeta, paginatedResult.Items)); } catch (Exception exp) { diff --git a/RMuseum/Services/Implementation/GanjoorService.cs b/RMuseum/Services/Implementation/GanjoorService.cs index b2acb050..da9109ea 100644 --- a/RMuseum/Services/Implementation/GanjoorService.cs +++ b/RMuseum/Services/Implementation/GanjoorService.cs @@ -54,7 +54,7 @@ namespace RMuseum.Services.Implementation command.CommandText = $"INSERT INTO GanjoorPoets (Id, Name, Description) VALUES (${poet.id}, N'{poet.name}', N'{poet.description}')"; await command.ExecuteNonQueryAsync(); - await _ImportSQLiteCatChildren(command, dapper, poetId, 0, poet.name, ""); + await _ImportSQLiteCatChildren(command, dapper, poetId, 0, "", ""); await transaction.CommitAsync(); } } @@ -102,7 +102,7 @@ namespace RMuseum.Services.Implementation foreach (var poem in await dapper.QueryAsync($"SELECT * FROM poem WHERE cat_id = {cat.id} ORDER BY id")) { command.CommandText = - $"INSERT INTO GanjoorPoems (Id, CatId, Title, UrlSlug, FullTitle, FullUrl) VALUES (${poem.id}, {cat.id}, N'{poem.title}', '{ _ExtractUrlSlug(poem.url)}', N'{$"{itemFullTitle} » {cat.text} » {poem.title}"}', '{itemFullSlug}/{ _ExtractUrlSlug(cat.url)}/{_ExtractUrlSlug(poem.url)}')"; + $"INSERT INTO GanjoorPoems (Id, CatId, Title, UrlSlug, FullTitle, FullUrl) VALUES (${poem.id}, {cat.id}, N'{poem.title}', '{ _ExtractUrlSlug(poem.url)}', N'{$"{itemFullTitle}{cat.text} » {poem.title}"}', '{itemFullSlug}/{ _ExtractUrlSlug(cat.url)}/{_ExtractUrlSlug(poem.url)}')"; await command.ExecuteNonQueryAsync(); foreach (var verse in await dapper.QueryAsync($"SELECT * FROM verse WHERE poem_id = {poem.id} ORDER BY vorder")) @@ -115,7 +115,7 @@ namespace RMuseum.Services.Implementation } - await _ImportSQLiteCatChildren(command, dapper, poetId, (int)cat.id, $"{itemFullTitle} » {cat.text}", $"{itemFullSlug}/{ _ExtractUrlSlug(cat.url)}"); + await _ImportSQLiteCatChildren(command, dapper, poetId, (int)cat.id, $"{itemFullTitle}{cat.text} » ", $"{itemFullSlug}/{ _ExtractUrlSlug(cat.url)}"); } diff --git a/RMuseum/appsettings.json b/RMuseum/appsettings.json index 18048eba..73abb188 100644 --- a/RMuseum/appsettings.json +++ b/RMuseum/appsettings.json @@ -41,7 +41,7 @@ }, "AudioMySqlServer": { "Server": "localhost", - "Username": "adab", + "Username": "root", "Password": "", "Database": "adab", "2ndDatabase": "audio",