diff options
author | Chocobozzz <me@florianbigard.com> | 2021-05-03 11:06:19 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-05-03 16:42:15 +0200 |
commit | 1fd61899eaea245a5844e33e21f04b2562f16e5e (patch) | |
tree | 2a1d51b37b12219cade35e189d62686cd0fec105 /server/models/video/video-query-builder.ts | |
parent | dfcb6f50a607b6b402b4f8fa3d43792d61c912a5 (diff) | |
download | PeerTube-1fd61899eaea245a5844e33e21f04b2562f16e5e.tar.gz PeerTube-1fd61899eaea245a5844e33e21f04b2562f16e5e.tar.zst PeerTube-1fd61899eaea245a5844e33e21f04b2562f16e5e.zip |
Add ability to filter my videos by live
Diffstat (limited to 'server/models/video/video-query-builder.ts')
-rw-r--r-- | server/models/video/video-query-builder.ts | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/server/models/video/video-query-builder.ts b/server/models/video/video-query-builder.ts index 4d95ddee2..155afe64b 100644 --- a/server/models/video/video-query-builder.ts +++ b/server/models/video/video-query-builder.ts | |||
@@ -16,9 +16,11 @@ export type BuildVideosQueryOptions = { | |||
16 | start: number | 16 | start: number |
17 | sort: string | 17 | sort: string |
18 | 18 | ||
19 | nsfw?: boolean | ||
19 | filter?: VideoFilter | 20 | filter?: VideoFilter |
21 | isLive?: boolean | ||
22 | |||
20 | categoryOneOf?: number[] | 23 | categoryOneOf?: number[] |
21 | nsfw?: boolean | ||
22 | licenceOneOf?: number[] | 24 | licenceOneOf?: number[] |
23 | languageOneOf?: string[] | 25 | languageOneOf?: string[] |
24 | tagsOneOf?: string[] | 26 | tagsOneOf?: string[] |
@@ -199,10 +201,14 @@ function buildListQuery (model: typeof Model, options: BuildVideosQueryOptions) | |||
199 | 201 | ||
200 | if (options.nsfw === true) { | 202 | if (options.nsfw === true) { |
201 | and.push('"video"."nsfw" IS TRUE') | 203 | and.push('"video"."nsfw" IS TRUE') |
204 | } else if (options.nsfw === false) { | ||
205 | and.push('"video"."nsfw" IS FALSE') | ||
202 | } | 206 | } |
203 | 207 | ||
204 | if (options.nsfw === false) { | 208 | if (options.isLive === true) { |
205 | and.push('"video"."nsfw" IS FALSE') | 209 | and.push('"video"."isLive" IS TRUE') |
210 | } else if (options.isLive === false) { | ||
211 | and.push('"video"."isLive" IS FALSE') | ||
206 | } | 212 | } |
207 | 213 | ||
208 | if (options.categoryOneOf) { | 214 | if (options.categoryOneOf) { |