diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-11-10 17:27:49 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-11-27 19:40:51 +0100 |
commit | 571389d43b8fc8aaf27e77c06f19b320b08dbbc9 (patch) | |
tree | e57173bcd0590d939c28952a29258fd02a281e35 /server/controllers/api/users.ts | |
parent | 38fa2065831b5f55be0d7f30f19a62c967397208 (diff) | |
download | PeerTube-571389d43b8fc8aaf27e77c06f19b320b08dbbc9.tar.gz PeerTube-571389d43b8fc8aaf27e77c06f19b320b08dbbc9.tar.zst PeerTube-571389d43b8fc8aaf27e77c06f19b320b08dbbc9.zip |
Make it compile at least
Diffstat (limited to 'server/controllers/api/users.ts')
-rw-r--r-- | server/controllers/api/users.ts | 42 |
1 files changed, 17 insertions, 25 deletions
diff --git a/server/controllers/api/users.ts b/server/controllers/api/users.ts index 9ec6feb57..41ffb64cb 100644 --- a/server/controllers/api/users.ts +++ b/server/controllers/api/users.ts | |||
@@ -1,37 +1,29 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | 2 | import { UserCreate, UserRight, UserRole, UserUpdate, UserUpdateMe, UserVideoRate as FormattedUserVideoRate } from '../../../shared' | |
3 | import { database as db, CONFIG } from '../../initializers' | 3 | import { getFormattedObjects, logger, retryTransactionWrapper } from '../../helpers' |
4 | import { logger, getFormattedObjects, retryTransactionWrapper } from '../../helpers' | 4 | import { CONFIG, database as db } from '../../initializers' |
5 | import { createUserAccountAndChannel } from '../../lib' | ||
5 | import { | 6 | import { |
7 | asyncMiddleware, | ||
6 | authenticate, | 8 | authenticate, |
7 | ensureUserHasRight, | 9 | ensureUserHasRight, |
8 | ensureUserRegistrationAllowed, | 10 | ensureUserRegistrationAllowed, |
9 | usersAddValidator, | ||
10 | usersRegisterValidator, | ||
11 | usersUpdateValidator, | ||
12 | usersUpdateMeValidator, | ||
13 | usersRemoveValidator, | ||
14 | usersVideoRatingValidator, | ||
15 | usersGetValidator, | ||
16 | paginationValidator, | 11 | paginationValidator, |
17 | setPagination, | 12 | setPagination, |
18 | usersSortValidator, | ||
19 | setUsersSort, | 13 | setUsersSort, |
20 | token, | 14 | token, |
21 | asyncMiddleware | 15 | usersAddValidator, |
16 | usersGetValidator, | ||
17 | usersRegisterValidator, | ||
18 | usersRemoveValidator, | ||
19 | usersSortValidator, | ||
20 | usersUpdateMeValidator, | ||
21 | usersUpdateValidator, | ||
22 | usersVideoRatingValidator | ||
22 | } from '../../middlewares' | 23 | } from '../../middlewares' |
23 | import { | ||
24 | UserVideoRate as FormattedUserVideoRate, | ||
25 | UserCreate, | ||
26 | UserUpdate, | ||
27 | UserUpdateMe, | ||
28 | UserRole, | ||
29 | UserRight | ||
30 | } from '../../../shared' | ||
31 | import { createUserAccountAndChannel } from '../../lib' | ||
32 | import { UserInstance } from '../../models' | ||
33 | import { videosSortValidator } from '../../middlewares/validators/sort' | ||
34 | import { setVideosSort } from '../../middlewares/sort' | 24 | import { setVideosSort } from '../../middlewares/sort' |
25 | import { videosSortValidator } from '../../middlewares/validators/sort' | ||
26 | import { UserInstance } from '../../models' | ||
35 | 27 | ||
36 | const usersRouter = express.Router() | 28 | const usersRouter = express.Router() |
37 | 29 | ||
@@ -176,9 +168,9 @@ function getUser (req: express.Request, res: express.Response, next: express.Nex | |||
176 | 168 | ||
177 | async function getUserVideoRating (req: express.Request, res: express.Response, next: express.NextFunction) { | 169 | async function getUserVideoRating (req: express.Request, res: express.Response, next: express.NextFunction) { |
178 | const videoId = +req.params.videoId | 170 | const videoId = +req.params.videoId |
179 | const userId = +res.locals.oauth.token.User.id | 171 | const accountId = +res.locals.oauth.token.User.Account.id |
180 | 172 | ||
181 | const ratingObj = await db.UserVideoRate.load(userId, videoId, null) | 173 | const ratingObj = await db.AccountVideoRate.load(accountId, videoId, null) |
182 | const rating = ratingObj ? ratingObj.type : 'none' | 174 | const rating = ratingObj ? ratingObj.type : 'none' |
183 | 175 | ||
184 | const json: FormattedUserVideoRate = { | 176 | const json: FormattedUserVideoRate = { |