diff options
author | Chocobozzz <me@florianbigard.com> | 2021-10-20 09:05:43 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-10-20 09:25:44 +0200 |
commit | 978c87e7f58b6673fe60f04f1767bc9e02ea4936 (patch) | |
tree | e7d48735d4099fec8c7732f33e7dadb09c0eac80 /server/models | |
parent | 7e76cc380040e40a2292a9dc825f037c9b538030 (diff) | |
download | PeerTube-978c87e7f58b6673fe60f04f1767bc9e02ea4936.tar.gz PeerTube-978c87e7f58b6673fe60f04f1767bc9e02ea4936.tar.zst PeerTube-978c87e7f58b6673fe60f04f1767bc9e02ea4936.zip |
Add channel filters for my videos/followers
Diffstat (limited to 'server/models')
-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, |