Added the pagenantion to get version list API

This commit is contained in:
ashutosh.nehete 2025-09-02 14:46:51 +05:30
parent c199e3e241
commit 067da422c2

View File

@ -383,7 +383,7 @@ namespace Marco.Pms.Services.Controllers
}
[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);
@ -410,6 +410,9 @@ namespace Marco.Pms.Services.Controllers
.Include(av => av.ChildAttachment)
.ThenInclude(da => da!.UpdatedBy)
.Where(av => av.ParentAttachmentId == parentAttachmentId && av.TenantId == tenantId)
.OrderByDescending(da => da.ChildAttachment!.UploadedAt)
.Skip((pageNumber - 1) * pageSize)
.Take(pageSize)
.ToListAsync();
var entityId = versionMappings.Select(av => av.ChildAttachment?.EntityId).FirstOrDefault();