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/video-channel.ts | |
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/video-channel.ts')
-rw-r--r-- | server/controllers/api/video-channel.ts | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/server/controllers/api/video-channel.ts b/server/controllers/api/video-channel.ts index 784f97b1e..7bdb33737 100644 --- a/server/controllers/api/video-channel.ts +++ b/server/controllers/api/video-channel.ts | |||
@@ -1,8 +1,9 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { pickCommonVideoQuery } from '@server/helpers/query' | ||
2 | import { Hooks } from '@server/lib/plugins/hooks' | 3 | import { Hooks } from '@server/lib/plugins/hooks' |
3 | import { getServerActor } from '@server/models/application/application' | 4 | import { getServerActor } from '@server/models/application/application' |
4 | import { MChannelBannerAccountDefault } from '@server/types/models' | 5 | import { MChannelBannerAccountDefault } from '@server/types/models' |
5 | import { ActorImageType, VideoChannelCreate, VideoChannelUpdate, VideosCommonQuery } from '../../../shared' | 6 | import { ActorImageType, VideoChannelCreate, VideoChannelUpdate } from '../../../shared' |
6 | import { HttpStatusCode } from '../../../shared/models/http/http-error-codes' | 7 | import { HttpStatusCode } from '../../../shared/models/http/http-error-codes' |
7 | import { auditLoggerFactory, getAuditIdFromRes, VideoChannelAuditView } from '../../helpers/audit-logger' | 8 | import { auditLoggerFactory, getAuditIdFromRes, VideoChannelAuditView } from '../../helpers/audit-logger' |
8 | import { resetSequelizeInstance } from '../../helpers/database-utils' | 9 | import { resetSequelizeInstance } from '../../helpers/database-utils' |
@@ -309,20 +310,13 @@ async function listVideoChannelVideos (req: express.Request, res: express.Respon | |||
309 | const videoChannelInstance = res.locals.videoChannel | 310 | const videoChannelInstance = res.locals.videoChannel |
310 | const followerActorId = isUserAbleToSearchRemoteURI(res) ? null : undefined | 311 | const followerActorId = isUserAbleToSearchRemoteURI(res) ? null : undefined |
311 | const countVideos = getCountVideos(req) | 312 | const countVideos = getCountVideos(req) |
312 | const query = req.query as VideosCommonQuery | 313 | const query = pickCommonVideoQuery(req.query) |
313 | 314 | ||
314 | const apiOptions = await Hooks.wrapObject({ | 315 | const apiOptions = await Hooks.wrapObject({ |
316 | ...query, | ||
317 | |||
315 | followerActorId, | 318 | followerActorId, |
316 | start: query.start, | ||
317 | count: query.count, | ||
318 | sort: query.sort, | ||
319 | includeLocalVideos: true, | 319 | includeLocalVideos: true, |
320 | categoryOneOf: query.categoryOneOf, | ||
321 | licenceOneOf: query.licenceOneOf, | ||
322 | languageOneOf: query.languageOneOf, | ||
323 | tagsOneOf: query.tagsOneOf, | ||
324 | tagsAllOf: query.tagsAllOf, | ||
325 | filter: query.filter, | ||
326 | nsfw: buildNSFWFilter(res, query.nsfw), | 320 | nsfw: buildNSFWFilter(res, query.nsfw), |
327 | withFiles: false, | 321 | withFiles: false, |
328 | videoChannelId: videoChannelInstance.id, | 322 | videoChannelId: videoChannelInstance.id, |