aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/users
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-08-15 11:53:26 +0200
committerChocobozzz <me@florianbigard.com>2019-08-19 17:26:35 +0200
commit453e83ea5d81d203ba34bc43cd5c2c750ba40568 (patch)
tree604e02f4343d13a4ba42e1fb7527ba6ab9111712 /server/controllers/api/users
parent13176a07a95984a53cc59aec5217f2ce9806d1bc (diff)
downloadPeerTube-453e83ea5d81d203ba34bc43cd5c2c750ba40568.tar.gz
PeerTube-453e83ea5d81d203ba34bc43cd5c2c750ba40568.tar.zst
PeerTube-453e83ea5d81d203ba34bc43cd5c2c750ba40568.zip
Stronger model typings
Diffstat (limited to 'server/controllers/api/users')
-rw-r--r--server/controllers/api/users/index.ts3
-rw-r--r--server/controllers/api/users/me.ts2
-rw-r--r--server/controllers/api/users/my-history.ts1
3 files changed, 3 insertions, 3 deletions
diff --git a/server/controllers/api/users/index.ts b/server/controllers/api/users/index.ts
index ae40e86f8..e6b678f3a 100644
--- a/server/controllers/api/users/index.ts
+++ b/server/controllers/api/users/index.ts
@@ -48,6 +48,7 @@ import { CONFIG } from '../../../initializers/config'
48import { sequelizeTypescript } from '../../../initializers/database' 48import { sequelizeTypescript } from '../../../initializers/database'
49import { UserAdminFlag } from '../../../../shared/models/users/user-flag.model' 49import { UserAdminFlag } from '../../../../shared/models/users/user-flag.model'
50import { UserRegister } from '../../../../shared/models/users/user-register.model' 50import { UserRegister } from '../../../../shared/models/users/user-register.model'
51import { MUser, MUserAccountDefault } from '@server/typings/models'
51 52
52const auditLogger = auditLoggerFactory('users') 53const auditLogger = auditLoggerFactory('users')
53 54
@@ -359,7 +360,7 @@ function success (req: express.Request, res: express.Response) {
359 res.end() 360 res.end()
360} 361}
361 362
362async function changeUserBlock (res: express.Response, user: UserModel, block: boolean, reason?: string) { 363async function changeUserBlock (res: express.Response, user: MUserAccountDefault, block: boolean, reason?: string) {
363 const oldUserAuditView = new UserAuditView(user.toFormattedJSON()) 364 const oldUserAuditView = new UserAuditView(user.toFormattedJSON())
364 365
365 user.blocked = block 366 user.blocked = block
diff --git a/server/controllers/api/users/me.ts b/server/controllers/api/users/me.ts
index e7ed3de64..af054f620 100644
--- a/server/controllers/api/users/me.ts
+++ b/server/controllers/api/users/me.ts
@@ -147,7 +147,7 @@ async function getUserVideoQuotaUsed (req: express.Request, res: express.Respons
147} 147}
148 148
149async function getUserVideoRating (req: express.Request, res: express.Response) { 149async function getUserVideoRating (req: express.Request, res: express.Response) {
150 const videoId = res.locals.video.id 150 const videoId = res.locals.videoId.id
151 const accountId = +res.locals.oauth.token.User.Account.id 151 const accountId = +res.locals.oauth.token.User.Account.id
152 152
153 const ratingObj = await AccountVideoRateModel.load(accountId, videoId, null) 153 const ratingObj = await AccountVideoRateModel.load(accountId, videoId, null)
diff --git a/server/controllers/api/users/my-history.ts b/server/controllers/api/users/my-history.ts
index 7025c0ff1..4da1f3496 100644
--- a/server/controllers/api/users/my-history.ts
+++ b/server/controllers/api/users/my-history.ts
@@ -7,7 +7,6 @@ import {
7 setDefaultPagination, 7 setDefaultPagination,
8 userHistoryRemoveValidator 8 userHistoryRemoveValidator
9} from '../../../middlewares' 9} from '../../../middlewares'
10import { UserModel } from '../../../models/account/user'
11import { getFormattedObjects } from '../../../helpers/utils' 10import { getFormattedObjects } from '../../../helpers/utils'
12import { UserVideoHistoryModel } from '../../../models/account/user-video-history' 11import { UserVideoHistoryModel } from '../../../models/account/user-video-history'
13import { sequelizeTypescript } from '../../../initializers' 12import { sequelizeTypescript } from '../../../initializers'