aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video/sql/video-model-get-query-builder.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-06-11 10:59:27 +0200
committerChocobozzz <me@florianbigard.com>2021-06-11 11:15:44 +0200
commit17bb45388ec319d288a1b8387c6c199fe2f6b64f (patch)
tree96a6b331ce1766eced50f78ab3ce0ed9197d8833 /server/models/video/sql/video-model-get-query-builder.ts
parentca4b4b2e5590c1b37cff1fe1be7f797b93351229 (diff)
downloadPeerTube-17bb45388ec319d288a1b8387c6c199fe2f6b64f.tar.gz
PeerTube-17bb45388ec319d288a1b8387c6c199fe2f6b64f.tar.zst
PeerTube-17bb45388ec319d288a1b8387c6c199fe2f6b64f.zip
Optimize rows parsing
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.ts8
1 files changed, 4 insertions, 4 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 1a921d802..892639076 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 { AbstractVideosModelQueryBuilder } from './shared/abstract-videos-model-query-builder'
3import { VideoAttributes } from './shared/video-attributes'
4import { VideoFileQueryBuilder } from './shared/video-file-query-builder' 3import { VideoFileQueryBuilder } from './shared/video-file-query-builder'
5import { VideoModelBuilder } from './shared/video-model-builder' 4import { VideoModelBuilder } from './shared/video-model-builder'
5import { VideoTables } from './shared/video-tables'
6 6
7/** 7/**
8 * 8 *
@@ -29,7 +29,7 @@ export class VideosModelGetQueryBuilder {
29 this.webtorrentFilesQueryBuilder = new VideoFileQueryBuilder(sequelize) 29 this.webtorrentFilesQueryBuilder = new VideoFileQueryBuilder(sequelize)
30 this.streamingPlaylistFilesQueryBuilder = new VideoFileQueryBuilder(sequelize) 30 this.streamingPlaylistFilesQueryBuilder = new VideoFileQueryBuilder(sequelize)
31 31
32 this.videoModelBuilder = new VideoModelBuilder('get', new VideoAttributes('get')) 32 this.videoModelBuilder = new VideoModelBuilder('get', new VideoTables('get'))
33 } 33 }
34 34
35 async queryVideos (options: BuildVideoGetQueryOptions) { 35 async queryVideos (options: BuildVideoGetQueryOptions) {
@@ -64,7 +64,7 @@ export class VideosModelGetQuerySubBuilder extends AbstractVideosModelQueryBuild
64 queryVideos (options: BuildVideoGetQueryOptions) { 64 queryVideos (options: BuildVideoGetQueryOptions) {
65 this.buildMainGetQuery(options) 65 this.buildMainGetQuery(options)
66 66
67 return this.runQuery(options.transaction, true) 67 return this.runQuery(options.transaction)
68 } 68 }
69 69
70 private buildMainGetQuery (options: BuildVideoGetQueryOptions) { 70 private buildMainGetQuery (options: BuildVideoGetQueryOptions) {
@@ -102,6 +102,6 @@ export class VideosModelGetQuerySubBuilder extends AbstractVideosModelQueryBuild
102 const order = 'ORDER BY "Tags"."name" ASC' 102 const order = 'ORDER BY "Tags"."name" ASC'
103 const from = `SELECT * FROM "video" ${this.where} LIMIT 1` 103 const from = `SELECT * FROM "video" ${this.where} LIMIT 1`
104 104
105 return `${this.buildSelect()} FROM (${from}) AS "video" ${this.joins.join(' ')} ${this.where} ${order}` 105 return `${this.buildSelect()} FROM (${from}) AS "video" ${this.joins.join(' ')} ${order}`
106 } 106 }
107} 107}