diff options
Diffstat (limited to 'server/controllers/api/users.ts')
-rw-r--r-- | server/controllers/api/users.ts | 10 |
1 files changed, 5 insertions, 5 deletions
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 | ||
3 | import { database as db } from '../../initializers/database' | 3 | import { database as db } from '../../initializers/database' |
4 | import { USER_ROLES } from '../../initializers' | 4 | import { USER_ROLES } from '../../initializers' |
5 | import { logger, getFormatedObjects } from '../../helpers' | 5 | import { logger, getFormattedObjects } from '../../helpers' |
6 | import { | 6 | import { |
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' |
20 | import { UserVideoRate as FormatedUserVideoRate, UserCreate, UserUpdate } from '../../../shared' | 20 | import { UserVideoRate as FormattedUserVideoRate, UserCreate, UserUpdate } from '../../../shared' |
21 | 21 | ||
22 | const usersRouter = express.Router() | 22 | const usersRouter = express.Router() |
23 | 23 | ||
@@ -95,7 +95,7 @@ function createUser (req: express.Request, res: express.Response, next: express. | |||
95 | 95 | ||
96 | function getUserInformation (req: express.Request, res: express.Response, next: express.NextFunction) { | 96 | function 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: | |||
118 | function listUsers (req: express.Request, res: express.Response, next: express.NextFunction) { | 118 | function 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 | } |