aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/jobs.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/api/jobs.ts')
-rw-r--r--server/controllers/api/jobs.ts14
1 files changed, 6 insertions, 8 deletions
diff --git a/server/controllers/api/jobs.ts b/server/controllers/api/jobs.ts
index f6fbff369..4e7cd1ee3 100644
--- a/server/controllers/api/jobs.ts
+++ b/server/controllers/api/jobs.ts
@@ -1,11 +1,9 @@
1import * as express from 'express' 1import * as express from 'express'
2import { asyncMiddleware, jobsSortValidator, setJobsSort, setPagination } from '../../middlewares' 2import { UserRight } from '../../../shared/models/users'
3import { paginationValidator } from '../../middlewares/validators/pagination' 3import { getFormattedObjects } from '../../helpers'
4import { database as db } from '../../initializers' 4import { asyncMiddleware, authenticate, ensureUserHasRight, jobsSortValidator, setJobsSort, setPagination } from '../../middlewares'
5import { getFormattedObjects } from '../../helpers/utils' 5import { paginationValidator } from '../../middlewares/validators'
6import { authenticate } from '../../middlewares/oauth' 6import { JobModel } from '../../models/job/job'
7import { ensureUserHasRight } from '../../middlewares/user-right'
8import { UserRight } from '../../../shared/models/users/user-right.enum'
9 7
10const jobsRouter = express.Router() 8const jobsRouter = express.Router()
11 9
@@ -28,7 +26,7 @@ export {
28// --------------------------------------------------------------------------- 26// ---------------------------------------------------------------------------
29 27
30async function listJobs (req: express.Request, res: express.Response, next: express.NextFunction) { 28async function listJobs (req: express.Request, res: express.Response, next: express.NextFunction) {
31 const resultList = await db.Job.listForApi(req.query.start, req.query.count, req.query.sort) 29 const resultList = await JobModel.listForApi(req.query.start, req.query.count, req.query.sort)
32 30
33 return res.json(getFormattedObjects(resultList.data, resultList.total)) 31 return res.json(getFormattedObjects(resultList.data, resultList.total))
34} 32}