Added the projectID filter in get invoice list API
This commit is contained in:
parent
e80728805b
commit
4dc37cb0ac
@ -50,7 +50,7 @@ namespace Marco.Pms.Services.Controllers
|
||||
#region =================================================================== Get Functions ===================================================================
|
||||
|
||||
[HttpGet("invoice/list")]
|
||||
public async Task<IActionResult> GetInvoiceListAsync([FromQuery] string? searchString, [FromQuery] DateTime? fromDate, [FromQuery] DateTime? toDate, [FromQuery] int pageSize = 20, [FromQuery] int pageNumber = 1
|
||||
public async Task<IActionResult> GetInvoiceListAsync([FromQuery] Guid? projectId, [FromQuery] string? searchString, [FromQuery] DateTime? fromDate, [FromQuery] DateTime? toDate, [FromQuery] int pageSize = 20, [FromQuery] int pageNumber = 1
|
||||
, [FromQuery] bool isActive = true, [FromQuery] bool isPending = false)
|
||||
{
|
||||
_logger.LogInfo(
|
||||
@ -83,6 +83,13 @@ namespace Marco.Pms.Services.Controllers
|
||||
_logger.LogDebug("Applied search filter with term: {SearchString}", searchString);
|
||||
}
|
||||
|
||||
// Apply project filter
|
||||
if (projectId.HasValue)
|
||||
{
|
||||
invoicesQuery = invoicesQuery.Where(i => i.ProjectId == projectId.Value);
|
||||
_logger.LogDebug("Applied project filter with term: {ProjectId}", projectId);
|
||||
}
|
||||
|
||||
// Get total count before pagination
|
||||
var totalEntites = await invoicesQuery.CountAsync();
|
||||
_logger.LogDebug("Total matching invoices: {TotalCount}", totalEntites);
|
||||
|
Loading…
x
Reference in New Issue
Block a user