diff options
author | Chocobozzz <me@florianbigard.com> | 2021-07-29 11:54:38 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-07-29 11:54:38 +0200 |
commit | d6886027109af42be2e3ec5d14ad166199add11d (patch) | |
tree | 3a7603d36ff35a2d623d863f14ab93a2e1e6b7f2 /server/controllers/api/users | |
parent | b033851fb54241bb703f86add025229e68cc6f59 (diff) | |
download | PeerTube-d6886027109af42be2e3ec5d14ad166199add11d.tar.gz PeerTube-d6886027109af42be2e3ec5d14ad166199add11d.tar.zst PeerTube-d6886027109af42be2e3ec5d14ad166199add11d.zip |
Refactor search query options
Diffstat (limited to 'server/controllers/api/users')
-rw-r--r-- | server/controllers/api/users/my-subscriptions.ts | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/server/controllers/api/users/my-subscriptions.ts b/server/controllers/api/users/my-subscriptions.ts index 84f519926..26a715704 100644 --- a/server/controllers/api/users/my-subscriptions.ts +++ b/server/controllers/api/users/my-subscriptions.ts | |||
@@ -1,8 +1,8 @@ | |||
1 | import 'multer' | 1 | import 'multer' |
2 | import * as express from 'express' | 2 | import * as express from 'express' |
3 | import { pickCommonVideoQuery } from '@server/helpers/query' | ||
3 | import { sendUndoFollow } from '@server/lib/activitypub/send' | 4 | import { sendUndoFollow } from '@server/lib/activitypub/send' |
4 | import { VideoChannelModel } from '@server/models/video/video-channel' | 5 | import { VideoChannelModel } from '@server/models/video/video-channel' |
5 | import { VideosCommonQuery } from '@shared/models' | ||
6 | import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' | 6 | import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' |
7 | import { buildNSFWFilter, getCountVideos } from '../../../helpers/express-utils' | 7 | import { buildNSFWFilter, getCountVideos } from '../../../helpers/express-utils' |
8 | import { getFormattedObjects } from '../../../helpers/utils' | 8 | import { getFormattedObjects } from '../../../helpers/utils' |
@@ -170,20 +170,13 @@ async function getUserSubscriptions (req: express.Request, res: express.Response | |||
170 | async function getUserSubscriptionVideos (req: express.Request, res: express.Response) { | 170 | async function getUserSubscriptionVideos (req: express.Request, res: express.Response) { |
171 | const user = res.locals.oauth.token.User | 171 | const user = res.locals.oauth.token.User |
172 | const countVideos = getCountVideos(req) | 172 | const countVideos = getCountVideos(req) |
173 | const query = req.query as VideosCommonQuery | 173 | const query = pickCommonVideoQuery(req.query) |
174 | 174 | ||
175 | const resultList = await VideoModel.listForApi({ | 175 | const resultList = await VideoModel.listForApi({ |
176 | start: query.start, | 176 | ...query, |
177 | count: query.count, | 177 | |
178 | sort: query.sort, | ||
179 | includeLocalVideos: false, | 178 | includeLocalVideos: false, |
180 | categoryOneOf: query.categoryOneOf, | ||
181 | licenceOneOf: query.licenceOneOf, | ||
182 | languageOneOf: query.languageOneOf, | ||
183 | tagsOneOf: query.tagsOneOf, | ||
184 | tagsAllOf: query.tagsAllOf, | ||
185 | nsfw: buildNSFWFilter(res, query.nsfw), | 179 | nsfw: buildNSFWFilter(res, query.nsfw), |
186 | filter: query.filter, | ||
187 | withFiles: false, | 180 | withFiles: false, |
188 | followerActorId: user.Account.Actor.id, | 181 | followerActorId: user.Account.Actor.id, |
189 | user, | 182 | user, |