diff options
Diffstat (limited to 'server/controllers/api/jobs.ts')
-rw-r--r-- | server/controllers/api/jobs.ts | 14 |
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 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { asyncMiddleware, jobsSortValidator, setJobsSort, setPagination } from '../../middlewares' | 2 | import { UserRight } from '../../../shared/models/users' |
3 | import { paginationValidator } from '../../middlewares/validators/pagination' | 3 | import { getFormattedObjects } from '../../helpers' |
4 | import { database as db } from '../../initializers' | 4 | import { asyncMiddleware, authenticate, ensureUserHasRight, jobsSortValidator, setJobsSort, setPagination } from '../../middlewares' |
5 | import { getFormattedObjects } from '../../helpers/utils' | 5 | import { paginationValidator } from '../../middlewares/validators' |
6 | import { authenticate } from '../../middlewares/oauth' | 6 | import { JobModel } from '../../models/job/job' |
7 | import { ensureUserHasRight } from '../../middlewares/user-right' | ||
8 | import { UserRight } from '../../../shared/models/users/user-right.enum' | ||
9 | 7 | ||
10 | const jobsRouter = express.Router() | 8 | const jobsRouter = express.Router() |
11 | 9 | ||
@@ -28,7 +26,7 @@ export { | |||
28 | // --------------------------------------------------------------------------- | 26 | // --------------------------------------------------------------------------- |
29 | 27 | ||
30 | async function listJobs (req: express.Request, res: express.Response, next: express.NextFunction) { | 28 | async 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 | } |