diff options
Diffstat (limited to 'server/models/video')
-rw-r--r-- | server/models/video/video.ts | 9 |
1 files changed, 8 insertions, 1 deletions
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<Partial<AttributesOnly<VideoModel>>> { | |||
978 | start: number | 978 | start: number |
979 | count: number | 979 | count: number |
980 | sort: string | 980 | sort: string |
981 | |||
982 | channelId?: number | ||
981 | isLive?: boolean | 983 | isLive?: boolean |
982 | search?: string | 984 | search?: string |
983 | }) { | 985 | }) { |
984 | const { accountId, start, count, sort, search, isLive } = options | 986 | const { accountId, channelId, start, count, sort, search, isLive } = options |
985 | 987 | ||
986 | function buildBaseQuery (): FindOptions { | 988 | function buildBaseQuery (): FindOptions { |
987 | const where: WhereOptions = {} | 989 | const where: WhereOptions = {} |
@@ -996,6 +998,10 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> { | |||
996 | where.isLive = isLive | 998 | where.isLive = isLive |
997 | } | 999 | } |
998 | 1000 | ||
1001 | const channelWhere = channelId | ||
1002 | ? { id: channelId } | ||
1003 | : {} | ||
1004 | |||
999 | const baseQuery = { | 1005 | const baseQuery = { |
1000 | offset: start, | 1006 | offset: start, |
1001 | limit: count, | 1007 | limit: count, |
@@ -1005,6 +1011,7 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> { | |||
1005 | { | 1011 | { |
1006 | model: VideoChannelModel, | 1012 | model: VideoChannelModel, |
1007 | required: true, | 1013 | required: true, |
1014 | where: channelWhere, | ||
1008 | include: [ | 1015 | include: [ |
1009 | { | 1016 | { |
1010 | model: AccountModel, | 1017 | model: AccountModel, |