diff options
author | Chocobozzz <me@florianbigard.com> | 2017-12-12 17:53:50 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2017-12-13 16:50:33 +0100 |
commit | 3fd3ab2d34d512b160a5e6084d7609be7b4f4452 (patch) | |
tree | e5ca358287fca6ecacce83defcf23af1e8e9f419 /server/controllers/api/jobs.ts | |
parent | c893d4514e6ecbf282c7985fe5f82b8acd8a1137 (diff) | |
download | PeerTube-3fd3ab2d34d512b160a5e6084d7609be7b4f4452.tar.gz PeerTube-3fd3ab2d34d512b160a5e6084d7609be7b4f4452.tar.zst PeerTube-3fd3ab2d34d512b160a5e6084d7609be7b4f4452.zip |
Move models to typescript-sequelize
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 | } |