aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/models/search
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-05-03 11:06:19 +0200
committerChocobozzz <me@florianbigard.com>2021-05-03 16:42:15 +0200
commit1fd61899eaea245a5844e33e21f04b2562f16e5e (patch)
tree2a1d51b37b12219cade35e189d62686cd0fec105 /shared/models/search
parentdfcb6f50a607b6b402b4f8fa3d43792d61c912a5 (diff)
downloadPeerTube-1fd61899eaea245a5844e33e21f04b2562f16e5e.tar.gz
PeerTube-1fd61899eaea245a5844e33e21f04b2562f16e5e.tar.zst
PeerTube-1fd61899eaea245a5844e33e21f04b2562f16e5e.zip
Add ability to filter my videos by live
Diffstat (limited to 'shared/models/search')
-rw-r--r--shared/models/search/boolean-both-query.model.ts1
-rw-r--r--shared/models/search/index.ts3
-rw-r--r--shared/models/search/nsfw-query.model.ts1
-rw-r--r--shared/models/search/videos-common-query.model.ts28
-rw-r--r--shared/models/search/videos-search-query.model.ts22
5 files changed, 33 insertions, 22 deletions
diff --git a/shared/models/search/boolean-both-query.model.ts b/shared/models/search/boolean-both-query.model.ts
new file mode 100644
index 000000000..57b0e8d44
--- /dev/null
+++ b/shared/models/search/boolean-both-query.model.ts
@@ -0,0 +1 @@
export type BooleanBothQuery = 'true' | 'false' | 'both'
diff --git a/shared/models/search/index.ts b/shared/models/search/index.ts
index e2d0ab620..697ceccb1 100644
--- a/shared/models/search/index.ts
+++ b/shared/models/search/index.ts
@@ -1,4 +1,5 @@
1export * from './nsfw-query.model' 1export * from './boolean-both-query.model'
2export * from './search-target-query.model' 2export * from './search-target-query.model'
3export * from './videos-common-query.model'
3export * from './videos-search-query.model' 4export * from './videos-search-query.model'
4export * from './video-channels-search-query.model' 5export * from './video-channels-search-query.model'
diff --git a/shared/models/search/nsfw-query.model.ts b/shared/models/search/nsfw-query.model.ts
deleted file mode 100644
index 6b6ad1991..000000000
--- a/shared/models/search/nsfw-query.model.ts
+++ /dev/null
@@ -1 +0,0 @@
1export type NSFWQuery = 'true' | 'false' | 'both'
diff --git a/shared/models/search/videos-common-query.model.ts b/shared/models/search/videos-common-query.model.ts
new file mode 100644
index 000000000..bd02489ea
--- /dev/null
+++ b/shared/models/search/videos-common-query.model.ts
@@ -0,0 +1,28 @@
1import { VideoFilter } from '../videos'
2import { BooleanBothQuery } from './boolean-both-query.model'
3
4// These query parameters can be used with any endpoint that list videos
5export interface VideosCommonQuery {
6 start?: number
7 count?: number
8 sort?: string
9
10 nsfw?: BooleanBothQuery
11
12 isLive?: boolean
13
14 categoryOneOf?: number[]
15
16 licenceOneOf?: number[]
17
18 languageOneOf?: string[]
19
20 tagsOneOf?: string[]
21 tagsAllOf?: string[]
22
23 filter?: VideoFilter
24}
25
26export interface VideosWithSearchCommonQuery extends VideosCommonQuery {
27 search?: string
28}
diff --git a/shared/models/search/videos-search-query.model.ts b/shared/models/search/videos-search-query.model.ts
index 3ce4ff73e..406f6cab2 100644
--- a/shared/models/search/videos-search-query.model.ts
+++ b/shared/models/search/videos-search-query.model.ts
@@ -1,33 +1,15 @@
1import { VideoFilter } from '../videos'
2import { NSFWQuery } from './nsfw-query.model'
3import { SearchTargetQuery } from './search-target-query.model' 1import { SearchTargetQuery } from './search-target-query.model'
2import { VideosCommonQuery } from './videos-common-query.model'
4 3
5export interface VideosSearchQuery extends SearchTargetQuery { 4export interface VideosSearchQuery extends SearchTargetQuery, VideosCommonQuery {
6 search?: string 5 search?: string
7 6
8 start?: number
9 count?: number
10 sort?: string
11
12 startDate?: string // ISO 8601 7 startDate?: string // ISO 8601
13 endDate?: string // ISO 8601 8 endDate?: string // ISO 8601
14 9
15 originallyPublishedStartDate?: string // ISO 8601 10 originallyPublishedStartDate?: string // ISO 8601
16 originallyPublishedEndDate?: string // ISO 8601 11 originallyPublishedEndDate?: string // ISO 8601
17 12
18 nsfw?: NSFWQuery
19
20 categoryOneOf?: number[]
21
22 licenceOneOf?: number[]
23
24 languageOneOf?: string[]
25
26 tagsOneOf?: string[]
27 tagsAllOf?: string[]
28
29 durationMin?: number // seconds 13 durationMin?: number // seconds
30 durationMax?: number // seconds 14 durationMax?: number // seconds
31
32 filter?: VideoFilter
33} 15}