diff options
author | Chocobozzz <me@florianbigard.com> | 2021-11-02 11:00:40 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-11-02 11:13:13 +0100 |
commit | 7e7d8e485356402e7652c61c9f004e850b0a1607 (patch) | |
tree | 71c498c886cfd4b623a3c208572dc656ed800443 /server/models/video/sql/videos-model-list-query-builder.ts | |
parent | fd5fa94bbc808e3ebb7a2e6bca636f2607566b52 (diff) | |
download | PeerTube-7e7d8e485356402e7652c61c9f004e850b0a1607.tar.gz PeerTube-7e7d8e485356402e7652c61c9f004e850b0a1607.tar.zst PeerTube-7e7d8e485356402e7652c61c9f004e850b0a1607.zip |
Some fixes for admin videos list
Diffstat (limited to 'server/models/video/sql/videos-model-list-query-builder.ts')
-rw-r--r-- | server/models/video/sql/videos-model-list-query-builder.ts | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/server/models/video/sql/videos-model-list-query-builder.ts b/server/models/video/sql/videos-model-list-query-builder.ts index cd721f055..b15b29ec3 100644 --- a/server/models/video/sql/videos-model-list-query-builder.ts +++ b/server/models/video/sql/videos-model-list-query-builder.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import { VideoInclude } from '@shared/models' | 1 | import { VideoInclude } from '@shared/models' |
2 | import { Sequelize } from 'sequelize' | 2 | import { Sequelize } from 'sequelize' |
3 | import { AbstractVideosModelQueryBuilder } from './shared/abstract-videos-model-query-builder' | 3 | import { AbstractVideoQueryBuilder } from './shared/abstract-video-query-builder' |
4 | import { VideoModelBuilder } from './shared/video-model-builder' | 4 | import { VideoModelBuilder } from './shared/video-model-builder' |
5 | import { BuildVideosListQueryOptions, VideosIdListQueryBuilder } from './videos-id-list-query-builder' | 5 | import { BuildVideosListQueryOptions, VideosIdListQueryBuilder } from './videos-id-list-query-builder' |
6 | 6 | ||
@@ -10,7 +10,7 @@ import { BuildVideosListQueryOptions, VideosIdListQueryBuilder } from './videos- | |||
10 | * | 10 | * |
11 | */ | 11 | */ |
12 | 12 | ||
13 | export class VideosModelListQueryBuilder extends AbstractVideosModelQueryBuilder { | 13 | export class VideosModelListQueryBuilder extends AbstractVideoQueryBuilder { |
14 | protected attributes: { [key: string]: string } | 14 | protected attributes: { [key: string]: string } |
15 | 15 | ||
16 | private innerQuery: string | 16 | private innerQuery: string |
@@ -26,7 +26,7 @@ export class VideosModelListQueryBuilder extends AbstractVideosModelQueryBuilder | |||
26 | 26 | ||
27 | queryVideos (options: BuildVideosListQueryOptions) { | 27 | queryVideos (options: BuildVideosListQueryOptions) { |
28 | this.buildInnerQuery(options) | 28 | this.buildInnerQuery(options) |
29 | this.buildListQueryFromIdsQuery(options) | 29 | this.buildMainQuery(options) |
30 | 30 | ||
31 | return this.runQuery() | 31 | return this.runQuery() |
32 | .then(rows => this.videoModelBuilder.buildVideosFromRows({ rows, include: options.include })) | 32 | .then(rows => this.videoModelBuilder.buildVideosFromRows({ rows, include: options.include })) |
@@ -34,14 +34,14 @@ export class VideosModelListQueryBuilder extends AbstractVideosModelQueryBuilder | |||
34 | 34 | ||
35 | private buildInnerQuery (options: BuildVideosListQueryOptions) { | 35 | private buildInnerQuery (options: BuildVideosListQueryOptions) { |
36 | const idsQueryBuilder = new VideosIdListQueryBuilder(this.sequelize) | 36 | const idsQueryBuilder = new VideosIdListQueryBuilder(this.sequelize) |
37 | const { query, sort, replacements } = idsQueryBuilder.getIdsListQueryAndSort(options) | 37 | const { query, sort, replacements } = idsQueryBuilder.getQuery(options) |
38 | 38 | ||
39 | this.replacements = replacements | 39 | this.replacements = replacements |
40 | this.innerQuery = query | 40 | this.innerQuery = query |
41 | this.innerSort = sort | 41 | this.innerSort = sort |
42 | } | 42 | } |
43 | 43 | ||
44 | private buildListQueryFromIdsQuery (options: BuildVideosListQueryOptions) { | 44 | private buildMainQuery (options: BuildVideosListQueryOptions) { |
45 | this.attributes = { | 45 | this.attributes = { |
46 | '"video".*': '' | 46 | '"video".*': '' |
47 | } | 47 | } |