diff options
Diffstat (limited to 'server/controllers/api')
-rw-r--r-- | server/controllers/api/users/me.ts | 22 |
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 @@ | |||
1 | import 'multer' | 1 | import 'multer' |
2 | import * as express from 'express' | 2 | import * as express from 'express' |
3 | import { auditLoggerFactory, getAuditIdFromRes, UserAuditView } from '@server/helpers/audit-logger' | 3 | import { auditLoggerFactory, getAuditIdFromRes, UserAuditView } from '@server/helpers/audit-logger' |
4 | import { UserUpdateMe, UserVideoRate as FormattedUserVideoRate, VideoSortField } from '../../../../shared' | 4 | import { Hooks } from '@server/lib/plugins/hooks' |
5 | import { UserUpdateMe, UserVideoRate as FormattedUserVideoRate } from '../../../../shared' | ||
5 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' | 6 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' |
6 | import { UserVideoQuota } from '../../../../shared/models/users/user-video-quota.model' | 7 | import { UserVideoQuota } from '../../../../shared/models/users/user-video-quota.model' |
7 | import { createReqFiles } from '../../../helpers/express-utils' | 8 | import { createReqFiles } from '../../../helpers/express-utils' |
@@ -104,12 +105,19 @@ export { | |||
104 | 105 | ||
105 | async function getUserVideos (req: express.Request, res: express.Response) { | 106 | async 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 = { |