+
+async function listAccountVideos (req: express.Request, res: express.Response) {
+ const account = res.locals.account
+ const followerActorId = isUserAbleToSearchRemoteURI(res) ? null : undefined
+ const countVideos = getCountVideos(req)
+ const query = req.query as VideosWithSearchCommonQuery
+
+ const apiOptions = await Hooks.wrapObject({
+ followerActorId,
+ start: query.start,
+ count: query.count,
+ sort: query.sort,
+ includeLocalVideos: true,
+ categoryOneOf: query.categoryOneOf,
+ licenceOneOf: query.licenceOneOf,
+ languageOneOf: query.languageOneOf,
+ tagsOneOf: query.tagsOneOf,
+ tagsAllOf: query.tagsAllOf,
+ filter: query.filter,
+ isLive: query.isLive,
+ nsfw: buildNSFWFilter(res, query.nsfw),
+ withFiles: false,
+ accountId: account.id,
+ user: res.locals.oauth ? res.locals.oauth.token.User : undefined,
+ countVideos,
+ search: query.search
+ }, 'filter:api.accounts.videos.list.params')
+
+ const resultList = await Hooks.wrapPromiseFun(
+ VideoModel.listForApi,
+ apiOptions,
+ 'filter:api.accounts.videos.list.result'
+ )
+
+ return res.json(getFormattedObjects(resultList.data, resultList.total))
+}
+
+async function listAccountRatings (req: express.Request, res: express.Response) {
+ const account = res.locals.account
+
+ const resultList = await AccountVideoRateModel.listByAccountForApi({
+ accountId: account.id,
+ start: req.query.start,
+ count: req.query.count,
+ sort: req.query.sort,
+ type: req.query.rating
+ })
+ return res.json(getFormattedObjects(resultList.rows, resultList.count))
+}