aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/jobs.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2017-12-12 17:53:50 +0100
committerChocobozzz <me@florianbigard.com>2017-12-13 16:50:33 +0100
commit3fd3ab2d34d512b160a5e6084d7609be7b4f4452 (patch)
treee5ca358287fca6ecacce83defcf23af1e8e9f419 /server/controllers/api/jobs.ts
parentc893d4514e6ecbf282c7985fe5f82b8acd8a1137 (diff)
downloadPeerTube-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.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}