+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,
+ start: req.query.start,
+ count: req.query.count,
+ asc,
+ jobType
+ })
+ const total = await JobQueue.Instance.count(state, jobType)
+
+ const result: ResultList<Job> = {