aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/users.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-11-10 17:27:49 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-11-27 19:40:51 +0100
commit571389d43b8fc8aaf27e77c06f19b320b08dbbc9 (patch)
treee57173bcd0590d939c28952a29258fd02a281e35 /server/controllers/api/users.ts
parent38fa2065831b5f55be0d7f30f19a62c967397208 (diff)
downloadPeerTube-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.ts42
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 @@
1import * as express from 'express' 1import * as express from 'express'
2 2import { UserCreate, UserRight, UserRole, UserUpdate, UserUpdateMe, UserVideoRate as FormattedUserVideoRate } from '../../../shared'
3import { database as db, CONFIG } from '../../initializers' 3import { getFormattedObjects, logger, retryTransactionWrapper } from '../../helpers'
4import { logger, getFormattedObjects, retryTransactionWrapper } from '../../helpers' 4import { CONFIG, database as db } from '../../initializers'
5import { createUserAccountAndChannel } from '../../lib'
5import { 6import {
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'
23import {
24 UserVideoRate as FormattedUserVideoRate,
25 UserCreate,
26 UserUpdate,
27 UserUpdateMe,
28 UserRole,
29 UserRight
30} from '../../../shared'
31import { createUserAccountAndChannel } from '../../lib'
32import { UserInstance } from '../../models'
33import { videosSortValidator } from '../../middlewares/validators/sort'
34import { setVideosSort } from '../../middlewares/sort' 24import { setVideosSort } from '../../middlewares/sort'
25import { videosSortValidator } from '../../middlewares/validators/sort'
26import { UserInstance } from '../../models'
35 27
36const usersRouter = express.Router() 28const usersRouter = express.Router()
37 29
@@ -176,9 +168,9 @@ function getUser (req: express.Request, res: express.Response, next: express.Nex
176 168
177async function getUserVideoRating (req: express.Request, res: express.Response, next: express.NextFunction) { 169async 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 = {