JobList filter fix
This commit is contained in:
@@ -36,7 +36,7 @@ public class JobsController : Controller
|
||||
public async Task<IActionResult> GetAll(
|
||||
[FromQuery] int start = 0,
|
||||
[FromQuery] int limit = 50,
|
||||
[FromQuery] JobStatus? status = null,
|
||||
[FromQuery] List<JobStatus>? statuses = null,
|
||||
[FromQuery] JobType? jobType = null,
|
||||
[FromQuery] Guid? layerId = null)
|
||||
{
|
||||
@@ -54,9 +54,9 @@ public class JobsController : Controller
|
||||
|
||||
var query = _db.QueueJobs.AsQueryable();
|
||||
|
||||
if (status.HasValue)
|
||||
if (statuses != null && statuses.Count > 0)
|
||||
{
|
||||
query = query.Where(j => j.Status == status.Value);
|
||||
query = query.Where(j => statuses.Contains(j.Status));
|
||||
}
|
||||
|
||||
if (jobType.HasValue)
|
||||
@@ -71,8 +71,11 @@ public class JobsController : Controller
|
||||
|
||||
var totalCount = await query.CountAsync();
|
||||
|
||||
// Sort by: Priority ASC (0=highest), JobType, then CreatedAt DESC
|
||||
var items = await query
|
||||
.OrderByDescending(j => j.CreatedAt)
|
||||
.OrderBy(j => j.Priority)
|
||||
.ThenBy(j => j.JobType)
|
||||
.ThenByDescending(j => j.CreatedAt)
|
||||
.Skip(start)
|
||||
.Take(limit)
|
||||
.AsNoTracking()
|
||||
|
||||
Reference in New Issue
Block a user