diff options
author | Chocobozzz <me@florianbigard.com> | 2019-12-04 14:49:59 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-12-04 14:49:59 +0100 |
commit | 1061c73fde3005100ead8764eacb444f240440d6 (patch) | |
tree | 0a548d7f0a9a548a52adf6d702dd589b04cd5ab0 /server/controllers/api | |
parent | 44df5c755c31798e64eba1ec41dd7e2d7ef50e56 (diff) | |
download | PeerTube-1061c73fde3005100ead8764eacb444f240440d6.tar.gz PeerTube-1061c73fde3005100ead8764eacb444f240440d6.tar.zst PeerTube-1061c73fde3005100ead8764eacb444f240440d6.zip |
Add ability to filter per job type
Diffstat (limited to 'server/controllers/api')
-rw-r--r-- | server/controllers/api/jobs.ts | 11 |
1 files changed, 9 insertions, 2 deletions
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', | |||
24 | jobsSortValidator, | 24 | jobsSortValidator, |
25 | setDefaultSort, | 25 | setDefaultSort, |
26 | setDefaultPagination, | 26 | setDefaultPagination, |
27 | asyncMiddleware(listJobsValidator), | 27 | listJobsValidator, |
28 | asyncMiddleware(listJobs) | 28 | asyncMiddleware(listJobs) |
29 | ) | 29 | ) |
30 | 30 | ||
@@ -39,8 +39,15 @@ export { | |||
39 | async function listJobs (req: express.Request, res: express.Response) { | 39 | async function listJobs (req: express.Request, res: express.Response) { |
40 | const state = req.params.state as JobState | 40 | const state = req.params.state as JobState |
41 | const asc = req.query.sort === 'createdAt' | 41 | const asc = req.query.sort === 'createdAt' |
42 | const jobType = req.query.jobType | ||
42 | 43 | ||
43 | const jobs = await JobQueue.Instance.listForApi(state, req.query.start, req.query.count, asc) | 44 | const jobs = await JobQueue.Instance.listForApi({ |
45 | state, | ||
46 | start: req.query.start, | ||
47 | count: req.query.count, | ||
48 | asc, | ||
49 | jobType | ||
50 | }) | ||
44 | const total = await JobQueue.Instance.count(state) | 51 | const total = await JobQueue.Instance.count(state) |
45 | 52 | ||
46 | const result: ResultList<any> = { | 53 | const result: ResultList<any> = { |