@23 removing CachedContent field and fixing poem full title

This commit is contained in:
Hamid Reza Mohammadi 2020-10-23 17:51:06 +03:30
parent dd144ecb81
commit 664c5808ec
10 changed files with 17 additions and 74 deletions

View File

@ -343,9 +343,6 @@ namespace RMuseum.Migrations
b.Property<int>("Id")
.HasColumnType("int");
b.Property<string>("CachedContent")
.HasColumnType("nvarchar(max)");
b.Property<string>("FullUrl")
.HasColumnType("nvarchar(max)");
@ -375,9 +372,6 @@ namespace RMuseum.Migrations
b.Property<int>("Id")
.HasColumnType("int");
b.Property<string>("CachedContent")
.HasColumnType("nvarchar(max)");
b.Property<int>("CatId")
.HasColumnType("int");

View File

@ -6,21 +6,11 @@ namespace RMuseum.Migrations
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "CachedContent",
table: "GanjoorPoems",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "FullUrl",
table: "GanjoorPoems",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "CachedContent",
table: "GanjoorCategories",
nullable: true);
migrationBuilder.AddColumn<string>(
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");

View File

@ -343,9 +343,6 @@ namespace RMuseum.Migrations
b.Property<int>("Id")
.HasColumnType("int");
b.Property<string>("CachedContent")
.HasColumnType("nvarchar(max)");
b.Property<string>("FullUrl")
.HasColumnType("nvarchar(450)");
@ -377,9 +374,6 @@ namespace RMuseum.Migrations
b.Property<int>("Id")
.HasColumnType("int");
b.Property<string>("CachedContent")
.HasColumnType("nvarchar(max)");
b.Property<int>("CatId")
.HasColumnType("int");

View File

@ -340,10 +340,7 @@ namespace RMuseum.Migrations
{
b.Property<int>("Id")
.HasColumnType("int");
b.Property<string>("CachedContent")
.HasColumnType("nvarchar(max)");
b.Property<string>("FullUrl")
.HasColumnType("nvarchar(450)");
@ -374,10 +371,7 @@ namespace RMuseum.Migrations
{
b.Property<int>("Id")
.HasColumnType("int");
b.Property<string>("CachedContent")
.HasColumnType("nvarchar(max)");
b.Property<int>("CatId")
.HasColumnType("int");

View File

@ -48,10 +48,5 @@ namespace RMuseum.Models.Ganjoor
/// sample: /hafez/ghazal
/// </summary>
public string FullUrl { get; set; }
/// <summary>
/// Cached Content to be used on UI
/// </summary>
public string CachedContent { get; set; }
}
}

View File

@ -43,10 +43,5 @@ namespace RMuseum.Models.Ganjoor
/// sample: /hafez/ghazal/sh1
/// </summary>
public string FullUrl { get; set; }
/// <summary>
/// Cached Content to be used on UI
/// </summary>
public string CachedContent { get; set; }
}
}

View File

@ -2807,11 +2807,6 @@
sample: /hafez/ghazal
</summary>
</member>
<member name="P:RMuseum.Models.Ganjoor.GanjoorCat.CachedContent">
<summary>
Cached Content to be used on UI
</summary>
</member>
<member name="T:RMuseum.Models.Ganjoor.GanjoorPoem">
<summary>
Ganjoor Poem
@ -2852,11 +2847,6 @@
sample: /hafez/ghazal/sh1
</summary>
</member>
<member name="P:RMuseum.Models.Ganjoor.GanjoorPoem.CachedContent">
<summary>
Cached Content to be used on UI
</summary>
</member>
<member name="T:RMuseum.Models.Ganjoor.GanjoorPoet">
<summary>
Ganjoor Poet

View File

@ -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<PoemNarration>.Paginate(source, paging);
List<PoemNarrationViewModel> res = new List<PoemNarrationViewModel>();
foreach(PoemNarration audio in paginatedResult.Items)
{
res.Add(new PoemNarrationViewModel(audio));
}
(PaginationMetadata PagingMeta, PoemNarrationViewModel[] Items) paginatedResult =
await QueryablePaginator<PoemNarrationViewModel>.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)
{

View File

@ -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)}");
}

View File

@ -41,7 +41,7 @@
},
"AudioMySqlServer": {
"Server": "localhost",
"Username": "adab",
"Username": "root",
"Password": "",
"Database": "adab",
"2ndDatabase": "audio",