aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/users/me.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-01-20 15:28:34 +0100
committerChocobozzz <me@florianbigard.com>2021-01-20 15:28:34 +0100
commita4d2ca071514b4838544f2fd7229d2e8cb9da0d4 (patch)
tree3fd3b95b38e3032197303d794d505ec9754b95e6 /server/controllers/api/users/me.ts
parent70fdff3d4e140d19587e7ea9e40c021185b06a9a (diff)
downloadPeerTube-a4d2ca071514b4838544f2fd7229d2e8cb9da0d4.tar.gz
PeerTube-a4d2ca071514b4838544f2fd7229d2e8cb9da0d4.tar.zst
PeerTube-a4d2ca071514b4838544f2fd7229d2e8cb9da0d4.zip
Add user video list hooks
Diffstat (limited to 'server/controllers/api/users/me.ts')
-rw-r--r--server/controllers/api/users/me.ts22
1 files changed, 15 insertions, 7 deletions
diff --git a/server/controllers/api/users/me.ts b/server/controllers/api/users/me.ts
index 009cf42b7..c4e8d8130 100644
--- a/server/controllers/api/users/me.ts
+++ b/server/controllers/api/users/me.ts
@@ -1,7 +1,8 @@
1import 'multer' 1import 'multer'
2import * as express from 'express' 2import * as express from 'express'
3import { auditLoggerFactory, getAuditIdFromRes, UserAuditView } from '@server/helpers/audit-logger' 3import { auditLoggerFactory, getAuditIdFromRes, UserAuditView } from '@server/helpers/audit-logger'
4import { UserUpdateMe, UserVideoRate as FormattedUserVideoRate, VideoSortField } from '../../../../shared' 4import { Hooks } from '@server/lib/plugins/hooks'
5import { UserUpdateMe, UserVideoRate as FormattedUserVideoRate } from '../../../../shared'
5import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' 6import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
6import { UserVideoQuota } from '../../../../shared/models/users/user-video-quota.model' 7import { UserVideoQuota } from '../../../../shared/models/users/user-video-quota.model'
7import { createReqFiles } from '../../../helpers/express-utils' 8import { createReqFiles } from '../../../helpers/express-utils'
@@ -104,12 +105,19 @@ export {
104 105
105async function getUserVideos (req: express.Request, res: express.Response) { 106async function getUserVideos (req: express.Request, res: express.Response) {
106 const user = res.locals.oauth.token.User 107 const user = res.locals.oauth.token.User
107 const resultList = await VideoModel.listUserVideosForApi( 108
108 user.Account.id, 109 const apiOptions = await Hooks.wrapObject({
109 req.query.start as number, 110 accountId: user.Account.id,
110 req.query.count as number, 111 start: req.query.start,
111 req.query.sort as VideoSortField, 112 count: req.query.count,
112 req.query.search as string 113 sort: req.query.sort,
114 search: req.query.search
115 }, 'filter:api.user.me.videos.list.params')
116
117 const resultList = await Hooks.wrapPromiseFun(
118 VideoModel.listUserVideosForApi,
119 apiOptions,
120 'filter:api.user.me.videos.list.result'
113 ) 121 )
114 122
115 const additionalAttributes = { 123 const additionalAttributes = {