#123 paging for unsynchronized images
This commit is contained in:
parent
f649341222
commit
280f048e14
@ -1669,8 +1669,9 @@ namespace RMuseum.Controllers
|
||||
|
||||
/// <summary>
|
||||
/// finds next unsynchronized suggested link with an aleady synched one from the artificat if exists,
|
||||
/// return value might be null or an array with length 1 or 2
|
||||
/// return value might be null or an array with length 1 or 2 (has paging-headers)
|
||||
/// </summary>
|
||||
/// <remarks>has paging-headers</remarks>
|
||||
/// <param name="skip"></param>
|
||||
/// <returns> return value might be null or an array with length 1 or 2</returns>
|
||||
[HttpGet]
|
||||
@ -1683,6 +1684,23 @@ namespace RMuseum.Controllers
|
||||
RServiceResult<GanjoorLinkViewModel[]> res = await _artifactService.GetNextUnsynchronizedSuggestedLinkWithAlreadySynchedOneForPoem(skip);
|
||||
if (!string.IsNullOrEmpty(res.ExceptionString))
|
||||
return BadRequest(res.ExceptionString);
|
||||
var resCount = await _artifactService.GetUnsynchronizedSuggestedLinksCount();
|
||||
if (!string.IsNullOrEmpty(resCount.ExceptionString))
|
||||
return BadRequest(resCount.ExceptionString);
|
||||
|
||||
// Paging Header
|
||||
HttpContext.Response.Headers.Add("paging-headers",
|
||||
JsonConvert.SerializeObject(
|
||||
new PaginationMetadata()
|
||||
{
|
||||
totalCount = resCount.Result,
|
||||
pageSize = -1,
|
||||
currentPage = -1,
|
||||
hasNextPage = false,
|
||||
hasPreviousPage = false,
|
||||
totalPages = -1
|
||||
})
|
||||
);
|
||||
return Ok(res.Result);
|
||||
}
|
||||
|
||||
|
||||
@ -481,8 +481,9 @@
|
||||
<member name="M:RMuseum.Controllers.ArtifactController.GetNextUnsynchronizedSuggestedLinkWithAlreadySynchedOneForPoem(System.Int32)">
|
||||
<summary>
|
||||
finds next unsynchronized suggested link with an aleady synched one from the artificat if exists,
|
||||
return value might be null or an array with length 1 or 2
|
||||
return value might be null or an array with length 1 or 2 (has paging-headers)
|
||||
</summary>
|
||||
<remarks>has paging-headers</remarks>
|
||||
<param name="skip"></param>
|
||||
<returns> return value might be null or an array with length 1 or 2</returns>
|
||||
</member>
|
||||
@ -6464,6 +6465,12 @@
|
||||
<param name="link"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.IArtifactService.GetUnsynchronizedSuggestedLinksCount">
|
||||
<summary>
|
||||
get Unsynchronized image count
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.IArtifactService.GetNextUnsynchronizedSuggestedLinkWithAlreadySynchedOneForPoem(System.Int32)">
|
||||
<summary>
|
||||
finds what the method name suggests
|
||||
@ -7429,6 +7436,12 @@
|
||||
<param name="link"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.Implementation.ArtifactService.GetUnsynchronizedSuggestedLinksCount">
|
||||
<summary>
|
||||
get Unsynchronized image count
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.Implementation.ArtifactService.GetNextUnsynchronizedSuggestedLinkWithAlreadySynchedOneForPoem(System.Int32)">
|
||||
<summary>
|
||||
finds what the method name suggests
|
||||
|
||||
@ -433,6 +433,12 @@ namespace RMuseum.Services
|
||||
/// <returns></returns>
|
||||
Task<RServiceResult<GanjoorLinkViewModel>> SuggestGanjoorLink(Guid userId, LinkSuggestion link);
|
||||
|
||||
/// <summary>
|
||||
/// get Unsynchronized image count
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<RServiceResult<int>> GetUnsynchronizedSuggestedLinksCount();
|
||||
|
||||
/// <summary>
|
||||
/// finds what the method name suggests
|
||||
/// </summary>
|
||||
|
||||
@ -2680,6 +2680,30 @@ namespace RMuseum.Services.Implementation
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// get Unsynchronized image count
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<RServiceResult<int>> GetUnsynchronizedSuggestedLinksCount()
|
||||
{
|
||||
try
|
||||
{
|
||||
return new RServiceResult<int>
|
||||
(
|
||||
await _context.GanjoorLinks.AsNoTracking()
|
||||
.Include(l => l.SuggestedBy)
|
||||
.Include(l => l.Artifact)
|
||||
.Include(l => l.Item).ThenInclude(i => i.Images)
|
||||
.Where(l => l.ReviewResult == ReviewResult.Approved && !l.Synchronized)
|
||||
.CountAsync()
|
||||
);
|
||||
}
|
||||
catch(Exception exp)
|
||||
{
|
||||
return new RServiceResult<int>(-1, exp.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// finds what the method name suggests
|
||||
/// </summary>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user