aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video/sql/video-model-get-query-builder.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/models/video/sql/video-model-get-query-builder.ts')
-rw-r--r--server/models/video/sql/video-model-get-query-builder.ts11
1 files changed, 6 insertions, 5 deletions
diff --git a/server/models/video/sql/video-model-get-query-builder.ts b/server/models/video/sql/video-model-get-query-builder.ts
index 2f34d5602..a65c96097 100644
--- a/server/models/video/sql/video-model-get-query-builder.ts
+++ b/server/models/video/sql/video-model-get-query-builder.ts
@@ -1,8 +1,8 @@
1import { Sequelize, Transaction } from 'sequelize' 1import { Sequelize, Transaction } from 'sequelize'
2import { AbstractVideosModelQueryBuilder } from './shared/abstract-videos-model-query-builder' 2import { AbstractVideoQueryBuilder } from './shared/abstract-video-query-builder'
3import { VideoFileQueryBuilder } from './shared/video-file-query-builder' 3import { VideoFileQueryBuilder } from './shared/video-file-query-builder'
4import { VideoModelBuilder } from './shared/video-model-builder' 4import { VideoModelBuilder } from './shared/video-model-builder'
5import { VideoTables } from './shared/video-tables' 5import { VideoTableAttributes } from './shared/video-table-attributes'
6 6
7/** 7/**
8 * 8 *
@@ -46,7 +46,7 @@ export class VideoModelGetQueryBuilder {
46 this.webtorrentFilesQueryBuilder = new VideoFileQueryBuilder(sequelize) 46 this.webtorrentFilesQueryBuilder = new VideoFileQueryBuilder(sequelize)
47 this.streamingPlaylistFilesQueryBuilder = new VideoFileQueryBuilder(sequelize) 47 this.streamingPlaylistFilesQueryBuilder = new VideoFileQueryBuilder(sequelize)
48 48
49 this.videoModelBuilder = new VideoModelBuilder('get', new VideoTables('get')) 49 this.videoModelBuilder = new VideoModelBuilder('get', new VideoTableAttributes('get'))
50 } 50 }
51 51
52 async queryVideo (options: BuildVideoGetQueryOptions) { 52 async queryVideo (options: BuildVideoGetQueryOptions) {
@@ -69,15 +69,16 @@ export class VideoModelGetQueryBuilder {
69 }) 69 })
70 70
71 if (videos.length > 1) { 71 if (videos.length > 1) {
72 throw new Error('Video results is more than ') 72 throw new Error('Video results is more than 1')
73 } 73 }
74 74
75 if (videos.length === 0) return null 75 if (videos.length === 0) return null
76
76 return videos[0] 77 return videos[0]
77 } 78 }
78} 79}
79 80
80export class VideosModelGetQuerySubBuilder extends AbstractVideosModelQueryBuilder { 81export class VideosModelGetQuerySubBuilder extends AbstractVideoQueryBuilder {
81 protected attributes: { [key: string]: string } 82 protected attributes: { [key: string]: string }
82 83
83 protected webtorrentFilesQuery: string 84 protected webtorrentFilesQuery: string