aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-10-27 14:37:04 +0200
committerChocobozzz <chocobozzz@cpy.re>2021-10-29 11:48:21 +0200
commit2760b454a761f6af3138b2fb5f34340772ab0d1e (patch)
tree2b3a2d81478f8b432eb54cce4caa5a760c494627 /shared
parente4611b54910d8e7f2b4f8a97ee2d9cc8e1054127 (diff)
downloadPeerTube-2760b454a761f6af3138b2fb5f34340772ab0d1e.tar.gz
PeerTube-2760b454a761f6af3138b2fb5f34340772ab0d1e.tar.zst
PeerTube-2760b454a761f6af3138b2fb5f34340772ab0d1e.zip
Deprecate filter video query
Introduce include and isLocal instead
Diffstat (limited to 'shared')
-rw-r--r--shared/extra-utils/videos/videos-command.ts10
-rw-r--r--shared/models/search/videos-common-query.model.ts17
-rw-r--r--shared/models/search/videos-search-query.model.ts3
-rw-r--r--shared/models/videos/index.ts3
-rw-r--r--shared/models/videos/video-filter.type.ts (renamed from shared/models/videos/video-query.type.ts)0
-rw-r--r--shared/models/videos/video-include.enum.ts7
-rw-r--r--shared/models/videos/video.model.ts20
7 files changed, 40 insertions, 20 deletions
diff --git a/shared/extra-utils/videos/videos-command.ts b/shared/extra-utils/videos/videos-command.ts
index c1a9ec806..68241f062 100644
--- a/shared/extra-utils/videos/videos-command.ts
+++ b/shared/extra-utils/videos/videos-command.ts
@@ -18,8 +18,7 @@ import {
18 VideoDetails, 18 VideoDetails,
19 VideoFileMetadata, 19 VideoFileMetadata,
20 VideoPrivacy, 20 VideoPrivacy,
21 VideosCommonQuery, 21 VideosCommonQuery
22 VideosWithSearchCommonQuery
23} from '@shared/models' 22} from '@shared/models'
24import { buildAbsoluteFixturePath, wait } from '../miscs' 23import { buildAbsoluteFixturePath, wait } from '../miscs'
25import { unwrapBody } from '../requests' 24import { unwrapBody } from '../requests'
@@ -246,7 +245,7 @@ export class VideosCommand extends AbstractCommand {
246 }) 245 })
247 } 246 }
248 247
249 listByAccount (options: OverrideCommandOptions & VideosWithSearchCommonQuery & { 248 listByAccount (options: OverrideCommandOptions & VideosCommonQuery & {
250 handle: string 249 handle: string
251 }) { 250 }) {
252 const { handle, search } = options 251 const { handle, search } = options
@@ -262,7 +261,7 @@ export class VideosCommand extends AbstractCommand {
262 }) 261 })
263 } 262 }
264 263
265 listByChannel (options: OverrideCommandOptions & VideosWithSearchCommonQuery & { 264 listByChannel (options: OverrideCommandOptions & VideosCommonQuery & {
266 handle: string 265 handle: string
267 }) { 266 }) {
268 const { handle } = options 267 const { handle } = options
@@ -605,7 +604,8 @@ export class VideosCommand extends AbstractCommand {
605 'languageOneOf', 604 'languageOneOf',
606 'tagsOneOf', 605 'tagsOneOf',
607 'tagsAllOf', 606 'tagsAllOf',
608 'filter', 607 'isLocal',
608 'include',
609 'skipCount' 609 'skipCount'
610 ]) 610 ])
611 } 611 }
diff --git a/shared/models/search/videos-common-query.model.ts b/shared/models/search/videos-common-query.model.ts
index 2f2e9a934..55a98e302 100644
--- a/shared/models/search/videos-common-query.model.ts
+++ b/shared/models/search/videos-common-query.model.ts
@@ -1,4 +1,4 @@
1import { VideoFilter } from '../videos' 1import { VideoInclude } from '../videos/video-include.enum'
2import { BooleanBothQuery } from './boolean-both-query.model' 2import { BooleanBothQuery } from './boolean-both-query.model'
3 3
4// These query parameters can be used with any endpoint that list videos 4// These query parameters can be used with any endpoint that list videos
@@ -11,6 +11,12 @@ export interface VideosCommonQuery {
11 11
12 isLive?: boolean 12 isLive?: boolean
13 13
14 // FIXME: deprecated in 4.0 in favour of isLocal and include, to remove
15 filter?: never
16
17 isLocal?: boolean
18 include?: VideoInclude
19
14 categoryOneOf?: number[] 20 categoryOneOf?: number[]
15 21
16 licenceOneOf?: number[] 22 licenceOneOf?: number[]
@@ -20,17 +26,16 @@ export interface VideosCommonQuery {
20 tagsOneOf?: string[] 26 tagsOneOf?: string[]
21 tagsAllOf?: string[] 27 tagsAllOf?: string[]
22 28
23 filter?: VideoFilter
24
25 skipCount?: boolean 29 skipCount?: boolean
30
31 search?: string
26} 32}
27 33
28export interface VideosCommonQueryAfterSanitize extends VideosCommonQuery { 34export interface VideosCommonQueryAfterSanitize extends VideosCommonQuery {
29 start: number 35 start: number
30 count: number 36 count: number
31 sort: string 37 sort: string
32}
33 38
34export interface VideosWithSearchCommonQuery extends VideosCommonQuery { 39 // FIXME: deprecated in 4.0, to remove
35 search?: string 40 filter?: never
36} 41}
diff --git a/shared/models/search/videos-search-query.model.ts b/shared/models/search/videos-search-query.model.ts
index a5436879d..447c72806 100644
--- a/shared/models/search/videos-search-query.model.ts
+++ b/shared/models/search/videos-search-query.model.ts
@@ -23,4 +23,7 @@ export interface VideosSearchQueryAfterSanitize extends VideosSearchQuery {
23 start: number 23 start: number
24 count: number 24 count: number
25 sort: string 25 sort: string
26
27 // FIXME: deprecated in 4.0, to remove
28 filter?: never
26} 29}
diff --git a/shared/models/videos/index.ts b/shared/models/videos/index.ts
index 733c433a0..3d3eedcc6 100644
--- a/shared/models/videos/index.ts
+++ b/shared/models/videos/index.ts
@@ -19,7 +19,8 @@ export * from './video-file-metadata.model'
19export * from './video-file.model' 19export * from './video-file.model'
20 20
21export * from './video-privacy.enum' 21export * from './video-privacy.enum'
22export * from './video-query.type' 22export * from './video-filter.type'
23export * from './video-include.enum'
23export * from './video-rate.type' 24export * from './video-rate.type'
24export * from './video-resolution.enum' 25export * from './video-resolution.enum'
25 26
diff --git a/shared/models/videos/video-query.type.ts b/shared/models/videos/video-filter.type.ts
index e641a401c..e641a401c 100644
--- a/shared/models/videos/video-query.type.ts
+++ b/shared/models/videos/video-filter.type.ts
diff --git a/shared/models/videos/video-include.enum.ts b/shared/models/videos/video-include.enum.ts
new file mode 100644
index 000000000..fa720b348
--- /dev/null
+++ b/shared/models/videos/video-include.enum.ts
@@ -0,0 +1,7 @@
1export const enum VideoInclude {
2 NONE = 0,
3 NOT_PUBLISHED_STATE = 1 << 0,
4 HIDDEN_PRIVACY = 1 << 1,
5 BLACKLISTED = 1 << 2,
6 BLOCKED_OWNER = 1 << 3
7}
diff --git a/shared/models/videos/video.model.ts b/shared/models/videos/video.model.ts
index 4a7e399a2..dadde38af 100644
--- a/shared/models/videos/video.model.ts
+++ b/shared/models/videos/video.model.ts
@@ -43,13 +43,6 @@ export interface Video {
43 dislikes: number 43 dislikes: number
44 nsfw: boolean 44 nsfw: boolean
45 45
46 waitTranscoding?: boolean
47 state?: VideoConstant<VideoState>
48 scheduledUpdate?: VideoScheduleUpdate
49
50 blacklisted?: boolean
51 blacklistedReason?: string
52
53 account: AccountSummary 46 account: AccountSummary
54 channel: VideoChannelSummary 47 channel: VideoChannelSummary
55 48
@@ -58,6 +51,17 @@ export interface Video {
58 } 51 }
59 52
60 pluginData?: any 53 pluginData?: any
54
55 // Additional attributes dependending on the query
56 waitTranscoding?: boolean
57 state?: VideoConstant<VideoState>
58 scheduledUpdate?: VideoScheduleUpdate
59
60 blacklisted?: boolean
61 blacklistedReason?: string
62
63 blockedOwner?: boolean
64 blockedServer?: boolean
61} 65}
62 66
63export interface VideoDetails extends Video { 67export interface VideoDetails extends Video {
@@ -70,7 +74,7 @@ export interface VideoDetails extends Video {
70 commentsEnabled: boolean 74 commentsEnabled: boolean
71 downloadEnabled: boolean 75 downloadEnabled: boolean
72 76
73 // Not optional in details (unlike in Video) 77 // Not optional in details (unlike in parent Video)
74 waitTranscoding: boolean 78 waitTranscoding: boolean
75 state: VideoConstant<VideoState> 79 state: VideoConstant<VideoState>
76 80