diff options
Diffstat (limited to 'server/models/video/sql/shared/video-file-query-builder.ts')
-rw-r--r-- | server/models/video/sql/shared/video-file-query-builder.ts | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/server/models/video/sql/shared/video-file-query-builder.ts b/server/models/video/sql/shared/video-file-query-builder.ts index 7d822f8fa..a62fa64f8 100644 --- a/server/models/video/sql/shared/video-file-query-builder.ts +++ b/server/models/video/sql/shared/video-file-query-builder.ts | |||
@@ -18,13 +18,13 @@ export class VideoFileQueryBuilder extends AbstractVideosModelQueryBuilder { | |||
18 | queryWebTorrentVideos (options: BuildVideoGetQueryOptions) { | 18 | queryWebTorrentVideos (options: BuildVideoGetQueryOptions) { |
19 | this.buildWebtorrentFilesQuery(options) | 19 | this.buildWebtorrentFilesQuery(options) |
20 | 20 | ||
21 | return this.runQuery(options.transaction) | 21 | return this.runQuery(options) |
22 | } | 22 | } |
23 | 23 | ||
24 | queryStreamingPlaylistVideos (options: BuildVideoGetQueryOptions) { | 24 | queryStreamingPlaylistVideos (options: BuildVideoGetQueryOptions) { |
25 | this.buildVideoStreamingPlaylistFilesQuery(options) | 25 | this.buildVideoStreamingPlaylistFilesQuery(options) |
26 | 26 | ||
27 | return this.runQuery(options.transaction) | 27 | return this.runQuery(options) |
28 | } | 28 | } |
29 | 29 | ||
30 | private buildWebtorrentFilesQuery (options: BuildVideoGetQueryOptions) { | 30 | private buildWebtorrentFilesQuery (options: BuildVideoGetQueryOptions) { |
@@ -34,11 +34,11 @@ export class VideoFileQueryBuilder extends AbstractVideosModelQueryBuilder { | |||
34 | 34 | ||
35 | this.includeWebtorrentFiles(true) | 35 | this.includeWebtorrentFiles(true) |
36 | 36 | ||
37 | if (options.forGetAPI === true) { | 37 | if (this.shouldIncludeRedundancies(options)) { |
38 | this.includeWebTorrentRedundancies() | 38 | this.includeWebTorrentRedundancies() |
39 | } | 39 | } |
40 | 40 | ||
41 | this.whereId(options.id) | 41 | this.whereId(options) |
42 | 42 | ||
43 | this.query = this.buildQuery() | 43 | this.query = this.buildQuery() |
44 | } | 44 | } |
@@ -50,11 +50,11 @@ export class VideoFileQueryBuilder extends AbstractVideosModelQueryBuilder { | |||
50 | 50 | ||
51 | this.includeStreamingPlaylistFiles(true) | 51 | this.includeStreamingPlaylistFiles(true) |
52 | 52 | ||
53 | if (options.forGetAPI === true) { | 53 | if (this.shouldIncludeRedundancies(options)) { |
54 | this.includeStreamingPlaylistRedundancies() | 54 | this.includeStreamingPlaylistRedundancies() |
55 | } | 55 | } |
56 | 56 | ||
57 | this.whereId(options.id) | 57 | this.whereId(options) |
58 | 58 | ||
59 | this.query = this.buildQuery() | 59 | this.query = this.buildQuery() |
60 | } | 60 | } |
@@ -62,4 +62,8 @@ export class VideoFileQueryBuilder extends AbstractVideosModelQueryBuilder { | |||
62 | private buildQuery () { | 62 | private buildQuery () { |
63 | return `${this.buildSelect()} FROM "video" ${this.joins} ${this.where}` | 63 | return `${this.buildSelect()} FROM "video" ${this.joins} ${this.where}` |
64 | } | 64 | } |
65 | |||
66 | private shouldIncludeRedundancies (options: BuildVideoGetQueryOptions) { | ||
67 | return options.type === 'api' | ||
68 | } | ||
65 | } | 69 | } |