From 1061c73fde3005100ead8764eacb444f240440d6 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 4 Dec 2019 14:49:59 +0100 Subject: Add ability to filter per job type --- server/controllers/api/jobs.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'server/controllers') diff --git a/server/controllers/api/jobs.ts b/server/controllers/api/jobs.ts index 1fa662349..05320311e 100644 --- a/server/controllers/api/jobs.ts +++ b/server/controllers/api/jobs.ts @@ -24,7 +24,7 @@ jobsRouter.get('/:state', jobsSortValidator, setDefaultSort, setDefaultPagination, - asyncMiddleware(listJobsValidator), + listJobsValidator, asyncMiddleware(listJobs) ) @@ -39,8 +39,15 @@ export { async function listJobs (req: express.Request, res: express.Response) { const state = req.params.state as JobState const asc = req.query.sort === 'createdAt' + const jobType = req.query.jobType - const jobs = await JobQueue.Instance.listForApi(state, req.query.start, req.query.count, asc) + const jobs = await JobQueue.Instance.listForApi({ + state, + start: req.query.start, + count: req.query.count, + asc, + jobType + }) const total = await JobQueue.Instance.count(state) const result: ResultList = { -- cgit v1.2.3