Added the pagenantion to get version list API
This commit is contained in:
parent
c199e3e241
commit
067da422c2
@ -383,7 +383,7 @@ namespace Marco.Pms.Services.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("list/versions/{parentAttachmentId}")]
|
[HttpGet("list/versions/{parentAttachmentId}")]
|
||||||
public async Task<IActionResult> GetListAllVersionsAsync(Guid parentAttachmentId)
|
public async Task<IActionResult> GetListAllVersionsAsync(Guid parentAttachmentId, [FromQuery] int pageNumber = 1, [FromQuery] int pageSize = 20)
|
||||||
{
|
{
|
||||||
_logger.LogInfo("Start fetching document versions for ParentAttachmentId: {ParentAttachmentId}", parentAttachmentId);
|
_logger.LogInfo("Start fetching document versions for ParentAttachmentId: {ParentAttachmentId}", parentAttachmentId);
|
||||||
|
|
||||||
@ -410,6 +410,9 @@ namespace Marco.Pms.Services.Controllers
|
|||||||
.Include(av => av.ChildAttachment)
|
.Include(av => av.ChildAttachment)
|
||||||
.ThenInclude(da => da!.UpdatedBy)
|
.ThenInclude(da => da!.UpdatedBy)
|
||||||
.Where(av => av.ParentAttachmentId == parentAttachmentId && av.TenantId == tenantId)
|
.Where(av => av.ParentAttachmentId == parentAttachmentId && av.TenantId == tenantId)
|
||||||
|
.OrderByDescending(da => da.ChildAttachment!.UploadedAt)
|
||||||
|
.Skip((pageNumber - 1) * pageSize)
|
||||||
|
.Take(pageSize)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
|
||||||
var entityId = versionMappings.Select(av => av.ChildAttachment?.EntityId).FirstOrDefault();
|
var entityId = versionMappings.Select(av => av.ChildAttachment?.EntityId).FirstOrDefault();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user