mirror of
https://github.com/Sea-Haven-Industries/shoc-backend.git
synced 2026-09-30 11:53:12 +00:00
Add server-side status and assignee filters to GetWorkOrderList
- Accept status and assignee query parameters - Filter in SQL before counting and paginating - Supports __unassigned for unassigned work orders - Accurate totalCount reflects filtered results
This commit is contained in:
parent
7d764f966d
commit
f89db3da52
1 changed files with 9 additions and 1 deletions
|
|
@ -369,7 +369,7 @@ namespace Api.SeaHavenIndustries.Controllers
|
|||
// GET: api/WorkOrder/GetWorkOrderList
|
||||
// -----------------------------------
|
||||
[HttpGet("GetWorkOrderList")]
|
||||
public IActionResult GetWorkOrderList(string? search = "", int page = 1, int pageSize = 12, string? sortBy = "lastUpdated", string? sortDir = "desc")
|
||||
public IActionResult GetWorkOrderList(string? search = "", int page = 1, int pageSize = 12, string? sortBy = "lastUpdated", string? sortDir = "desc", string? status = "", string? assignee = "")
|
||||
{
|
||||
search ??= "";
|
||||
|
||||
|
|
@ -378,6 +378,14 @@ namespace Api.SeaHavenIndustries.Controllers
|
|||
.Include(w => w.AssignToUser)
|
||||
.Where(w => w.istemplate != true);
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(status))
|
||||
query = query.Where(w => w.Status == status);
|
||||
|
||||
if (assignee == "__unassigned")
|
||||
query = query.Where(w => w.AssignTo == null || w.AssignTo == "");
|
||||
else if (!string.IsNullOrWhiteSpace(assignee))
|
||||
query = query.Where(w => w.AssignToUser != null && (w.AssignToUser.FirstName + " " + w.AssignToUser.LastName).Contains(assignee));
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(search))
|
||||
{
|
||||
var s = search.ToLower();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue