#125 page modifications history in service

This commit is contained in:
Hamid Reza Mohammadi 2021-05-30 19:43:59 +04:30
parent 0e1af6b578
commit 9df0f854dc
4 changed files with 99 additions and 0 deletions

View File

@ -0,0 +1,24 @@
using System;
namespace RMuseum.Models.Ganjoor.ViewModels
{
/// <summary>
/// GanjoorPageSnapshot summary view model
/// </summary>
public class GanjoorPageSnapshotSummaryViewModel
{
/// <summary>
/// id
/// </summary>
public int Id { get; set; }
/// <summary>
/// record date
/// </summary>
public DateTime RecordDate { get; set; }
/// <summary>
/// a description of the modfication
/// </summary>
public string Note { get; set; }
}
}

View File

@ -4870,6 +4870,26 @@
previous normal page
</summary>
</member>
<member name="T:RMuseum.Models.Ganjoor.ViewModels.GanjoorPageSnapshotSummaryViewModel">
<summary>
GanjoorPageSnapshot summary view model
</summary>
</member>
<member name="P:RMuseum.Models.Ganjoor.ViewModels.GanjoorPageSnapshotSummaryViewModel.Id">
<summary>
id
</summary>
</member>
<member name="P:RMuseum.Models.Ganjoor.ViewModels.GanjoorPageSnapshotSummaryViewModel.RecordDate">
<summary>
record date
</summary>
</member>
<member name="P:RMuseum.Models.Ganjoor.ViewModels.GanjoorPageSnapshotSummaryViewModel.Note">
<summary>
a description of the modfication
</summary>
</member>
<member name="T:RMuseum.Models.Ganjoor.ViewModels.GanjoorPageSummaryViewModel">
<summary>
Ganjoor Page: Summary View Model
@ -6854,6 +6874,13 @@
<param name="commentId"></param>
<returns></returns>
</member>
<member name="M:RMuseum.Services.IGanjoorService.GetOlderVersionsOfPage(System.Int32)">
<summary>
return page modifications history
</summary>
<param name="pageId"></param>
<returns></returns>
</member>
<member name="M:RMuseum.Services.IGanjoorService.Search(RSecurityBackend.Models.Generic.PagingParameterModel,System.String,System.Nullable{System.Int32},System.Nullable{System.Int32})">
<summary>
Search
@ -7963,6 +7990,13 @@
<param name="pageData"></param>
<returns></returns>
</member>
<member name="M:RMuseum.Services.Implementation.GanjoorService.GetOlderVersionsOfPage(System.Int32)">
<summary>
return page modifications history
</summary>
<param name="pageId"></param>
<returns></returns>
</member>
<member name="M:RMuseum.Services.Implementation.GanjoorService.GetGanjoorMetres">
<summary>
returns metre list (ordered by Rhythm)

View File

@ -310,6 +310,13 @@ namespace RMuseum.Services
/// <returns></returns>
Task CacheCleanForComment(int commentId);
/// <summary>
/// page modifications history
/// </summary>
/// <param name="pageId"></param>
/// <returns></returns>
Task<RServiceResult<GanjoorPageSnapshotSummaryViewModel[]>> GetOlderVersionsOfPage(int pageId);
/// <summary>
/// Search

View File

@ -2212,6 +2212,40 @@ namespace RMuseum.Services.Implementation
}
}
/// <summary>
/// return page modifications history
/// </summary>
/// <param name="pageId"></param>
/// <returns></returns>
public async Task<RServiceResult<GanjoorPageSnapshotSummaryViewModel[]>> GetOlderVersionsOfPage(int pageId)
{
try
{
return
new RServiceResult<GanjoorPageSnapshotSummaryViewModel[]>
(
await _context.GanjoorPageSnapshots.AsNoTracking()
.Where(s => s.GanjoorPageId == pageId)
.OrderByDescending(s => s.RecordDate)
.Select
(
s =>
new GanjoorPageSnapshotSummaryViewModel()
{
Id = s.Id,
RecordDate = s.RecordDate,
Note = s.Note
}
)
.ToArrayAsync()
);
}
catch(Exception exp)
{
return new RServiceResult<GanjoorPageSnapshotSummaryViewModel[]>(null, exp.ToString());
}
}
/// <summary>
/// returns metre list (ordered by Rhythm)
/// </summary>