aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/api')
-rw-r--r--server/controllers/api/pods.ts6
-rw-r--r--server/controllers/api/users.ts10
-rw-r--r--server/controllers/api/videos/abuse.ts4
-rw-r--r--server/controllers/api/videos/index.ts8
4 files changed, 14 insertions, 14 deletions
diff --git a/server/controllers/api/pods.ts b/server/controllers/api/pods.ts
index 916b131d9..e1fa4b7e8 100644
--- a/server/controllers/api/pods.ts
+++ b/server/controllers/api/pods.ts
@@ -5,7 +5,7 @@ import { CONFIG } from '../../initializers'
5import { 5import {
6 logger, 6 logger,
7 getMyPublicCert, 7 getMyPublicCert,
8 getFormatedObjects 8 getFormattedObjects
9} from '../../helpers' 9} from '../../helpers'
10import { 10import {
11 sendOwnedVideosToPod, 11 sendOwnedVideosToPod,
@@ -25,7 +25,7 @@ import {
25import { 25import {
26 PodInstance 26 PodInstance
27} from '../../models' 27} from '../../models'
28import { Pod as FormatedPod } from '../../../shared' 28import { Pod as FormattedPod } from '../../../shared'
29 29
30const podsRouter = express.Router() 30const podsRouter = express.Router()
31 31
@@ -81,7 +81,7 @@ function addPods (req: express.Request, res: express.Response, next: express.Nex
81 81
82function listPods (req: express.Request, res: express.Response, next: express.NextFunction) { 82function listPods (req: express.Request, res: express.Response, next: express.NextFunction) {
83 db.Pod.list() 83 db.Pod.list()
84 .then(podsList => res.json(getFormatedObjects<FormatedPod, PodInstance>(podsList, podsList.length))) 84 .then(podsList => res.json(getFormattedObjects<FormattedPod, PodInstance>(podsList, podsList.length)))
85 .catch(err => next(err)) 85 .catch(err => next(err))
86} 86}
87 87
diff --git a/server/controllers/api/users.ts b/server/controllers/api/users.ts
index f50dbc9a3..04d885185 100644
--- a/server/controllers/api/users.ts
+++ b/server/controllers/api/users.ts
@@ -2,7 +2,7 @@ import * as express from 'express'
2 2
3import { database as db } from '../../initializers/database' 3import { database as db } from '../../initializers/database'
4import { USER_ROLES } from '../../initializers' 4import { USER_ROLES } from '../../initializers'
5import { logger, getFormatedObjects } from '../../helpers' 5import { logger, getFormattedObjects } from '../../helpers'
6import { 6import {
7 authenticate, 7 authenticate,
8 ensureIsAdmin, 8 ensureIsAdmin,
@@ -17,7 +17,7 @@ import {
17 setUsersSort, 17 setUsersSort,
18 token 18 token
19} from '../../middlewares' 19} from '../../middlewares'
20import { UserVideoRate as FormatedUserVideoRate, UserCreate, UserUpdate } from '../../../shared' 20import { UserVideoRate as FormattedUserVideoRate, UserCreate, UserUpdate } from '../../../shared'
21 21
22const usersRouter = express.Router() 22const usersRouter = express.Router()
23 23
@@ -95,7 +95,7 @@ function createUser (req: express.Request, res: express.Response, next: express.
95 95
96function getUserInformation (req: express.Request, res: express.Response, next: express.NextFunction) { 96function getUserInformation (req: express.Request, res: express.Response, next: express.NextFunction) {
97 db.User.loadByUsername(res.locals.oauth.token.user.username) 97 db.User.loadByUsername(res.locals.oauth.token.user.username)
98 .then(user => res.json(user.toFormatedJSON())) 98 .then(user => res.json(user.toFormattedJSON()))
99 .catch(err => next(err)) 99 .catch(err => next(err))
100} 100}
101 101
@@ -106,7 +106,7 @@ function getUserVideoRating (req: express.Request, res: express.Response, next:
106 db.UserVideoRate.load(userId, videoId, null) 106 db.UserVideoRate.load(userId, videoId, null)
107 .then(ratingObj => { 107 .then(ratingObj => {
108 const rating = ratingObj ? ratingObj.type : 'none' 108 const rating = ratingObj ? ratingObj.type : 'none'
109 const json: FormatedUserVideoRate = { 109 const json: FormattedUserVideoRate = {
110 videoId, 110 videoId,
111 rating 111 rating
112 } 112 }
@@ -118,7 +118,7 @@ function getUserVideoRating (req: express.Request, res: express.Response, next:
118function listUsers (req: express.Request, res: express.Response, next: express.NextFunction) { 118function listUsers (req: express.Request, res: express.Response, next: express.NextFunction) {
119 db.User.listForApi(req.query.start, req.query.count, req.query.sort) 119 db.User.listForApi(req.query.start, req.query.count, req.query.sort)
120 .then(resultList => { 120 .then(resultList => {
121 res.json(getFormatedObjects(resultList.data, resultList.total)) 121 res.json(getFormattedObjects(resultList.data, resultList.total))
122 }) 122 })
123 .catch(err => next(err)) 123 .catch(err => next(err))
124} 124}
diff --git a/server/controllers/api/videos/abuse.ts b/server/controllers/api/videos/abuse.ts
index 5cf0303fb..c9313d5f5 100644
--- a/server/controllers/api/videos/abuse.ts
+++ b/server/controllers/api/videos/abuse.ts
@@ -4,7 +4,7 @@ import { database as db } from '../../../initializers/database'
4import * as friends from '../../../lib/friends' 4import * as friends from '../../../lib/friends'
5import { 5import {
6 logger, 6 logger,
7 getFormatedObjects, 7 getFormattedObjects,
8 retryTransactionWrapper 8 retryTransactionWrapper
9} from '../../../helpers' 9} from '../../../helpers'
10import { 10import {
@@ -46,7 +46,7 @@ export {
46 46
47function listVideoAbuses (req: express.Request, res: express.Response, next: express.NextFunction) { 47function listVideoAbuses (req: express.Request, res: express.Response, next: express.NextFunction) {
48 db.VideoAbuse.listForApi(req.query.start, req.query.count, req.query.sort) 48 db.VideoAbuse.listForApi(req.query.start, req.query.count, req.query.sort)
49 .then(result => res.json(getFormatedObjects(result.data, result.total))) 49 .then(result => res.json(getFormattedObjects(result.data, result.total)))
50 .catch(err => next(err)) 50 .catch(err => next(err))
51} 51}
52 52
diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts
index d71a132ed..f639df098 100644
--- a/server/controllers/api/videos/index.ts
+++ b/server/controllers/api/videos/index.ts
@@ -36,7 +36,7 @@ import {
36 logger, 36 logger,
37 retryTransactionWrapper, 37 retryTransactionWrapper,
38 generateRandomString, 38 generateRandomString,
39 getFormatedObjects, 39 getFormattedObjects,
40 renamePromise 40 renamePromise
41} from '../../../helpers' 41} from '../../../helpers'
42import { TagInstance } from '../../../models' 42import { TagInstance } from '../../../models'
@@ -386,12 +386,12 @@ function getVideo (req: express.Request, res: express.Response, next: express.Ne
386 } 386 }
387 387
388 // Do not wait the view system 388 // Do not wait the view system
389 res.json(videoInstance.toFormatedJSON()) 389 res.json(videoInstance.toFormattedJSON())
390} 390}
391 391
392function listVideos (req: express.Request, res: express.Response, next: express.NextFunction) { 392function listVideos (req: express.Request, res: express.Response, next: express.NextFunction) {
393 db.Video.listForApi(req.query.start, req.query.count, req.query.sort) 393 db.Video.listForApi(req.query.start, req.query.count, req.query.sort)
394 .then(result => res.json(getFormatedObjects(result.data, result.total))) 394 .then(result => res.json(getFormattedObjects(result.data, result.total)))
395 .catch(err => next(err)) 395 .catch(err => next(err))
396} 396}
397 397
@@ -408,6 +408,6 @@ function removeVideo (req: express.Request, res: express.Response, next: express
408 408
409function searchVideos (req: express.Request, res: express.Response, next: express.NextFunction) { 409function searchVideos (req: express.Request, res: express.Response, next: express.NextFunction) {
410 db.Video.searchAndPopulateAuthorAndPodAndTags(req.params.value, req.query.field, req.query.start, req.query.count, req.query.sort) 410 db.Video.searchAndPopulateAuthorAndPodAndTags(req.params.value, req.query.field, req.query.start, req.query.count, req.query.sort)
411 .then(result => res.json(getFormatedObjects(result.data, result.total))) 411 .then(result => res.json(getFormattedObjects(result.data, result.total)))
412 .catch(err => next(err)) 412 .catch(err => next(err))
413} 413}