From 978c87e7f58b6673fe60f04f1767bc9e02ea4936 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 20 Oct 2021 09:05:43 +0200 Subject: Add channel filters for my videos/followers --- server/models/video/video.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'server/models') diff --git a/server/models/video/video.ts b/server/models/video/video.ts index d2daf18ee..4044287ee 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts @@ -978,10 +978,12 @@ export class VideoModel extends Model>> { start: number count: number sort: string + + channelId?: number isLive?: boolean search?: string }) { - const { accountId, start, count, sort, search, isLive } = options + const { accountId, channelId, start, count, sort, search, isLive } = options function buildBaseQuery (): FindOptions { const where: WhereOptions = {} @@ -996,6 +998,10 @@ export class VideoModel extends Model>> { where.isLive = isLive } + const channelWhere = channelId + ? { id: channelId } + : {} + const baseQuery = { offset: start, limit: count, @@ -1005,6 +1011,7 @@ export class VideoModel extends Model>> { { model: VideoChannelModel, required: true, + where: channelWhere, include: [ { model: AccountModel, -- cgit v1.2.3