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/shared | |
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/shared')
-rw-r--r-- | server/models/video/sql/shared/abstract-run-query.ts (renamed from server/models/video/sql/shared/abstract-videos-query-builder.ts) | 2 | ||||
-rw-r--r-- | server/models/video/sql/shared/abstract-video-query-builder.ts (renamed from server/models/video/sql/shared/abstract-videos-model-query-builder.ts) | 10 | ||||
-rw-r--r-- | server/models/video/sql/shared/video-file-query-builder.ts | 4 | ||||
-rw-r--r-- | server/models/video/sql/shared/video-model-builder.ts | 4 | ||||
-rw-r--r-- | server/models/video/sql/shared/video-table-attributes.ts (renamed from server/models/video/sql/shared/video-tables.ts) | 32 |
5 files changed, 25 insertions, 27 deletions
diff --git a/server/models/video/sql/shared/abstract-videos-query-builder.ts b/server/models/video/sql/shared/abstract-run-query.ts index 09776bcb0..8e7a7642d 100644 --- a/server/models/video/sql/shared/abstract-videos-query-builder.ts +++ b/server/models/video/sql/shared/abstract-run-query.ts | |||
@@ -6,7 +6,7 @@ import { QueryTypes, Sequelize, Transaction } from 'sequelize' | |||
6 | * | 6 | * |
7 | */ | 7 | */ |
8 | 8 | ||
9 | export class AbstractVideosQueryBuilder { | 9 | export class AbstractRunQuery { |
10 | protected sequelize: Sequelize | 10 | protected sequelize: Sequelize |
11 | 11 | ||
12 | protected query: string | 12 | protected query: string |
diff --git a/server/models/video/sql/shared/abstract-videos-model-query-builder.ts b/server/models/video/sql/shared/abstract-video-query-builder.ts index 29827db2a..a6afb04e4 100644 --- a/server/models/video/sql/shared/abstract-videos-model-query-builder.ts +++ b/server/models/video/sql/shared/abstract-video-query-builder.ts | |||
@@ -1,8 +1,8 @@ | |||
1 | import { createSafeIn } from '@server/models/utils' | 1 | import { createSafeIn } from '@server/models/utils' |
2 | import { MUserAccountId } from '@server/types/models' | 2 | import { MUserAccountId } from '@server/types/models' |
3 | import validator from 'validator' | 3 | import validator from 'validator' |
4 | import { AbstractVideosQueryBuilder } from './abstract-videos-query-builder' | 4 | import { AbstractRunQuery } from './abstract-run-query' |
5 | import { VideoTables } from './video-tables' | 5 | import { VideoTableAttributes } from './video-table-attributes' |
6 | 6 | ||
7 | /** | 7 | /** |
8 | * | 8 | * |
@@ -10,18 +10,18 @@ import { VideoTables } from './video-tables' | |||
10 | * | 10 | * |
11 | */ | 11 | */ |
12 | 12 | ||
13 | export class AbstractVideosModelQueryBuilder extends AbstractVideosQueryBuilder { | 13 | export class AbstractVideoQueryBuilder extends AbstractRunQuery { |
14 | protected attributes: { [key: string]: string } = {} | 14 | protected attributes: { [key: string]: string } = {} |
15 | 15 | ||
16 | protected joins = '' | 16 | protected joins = '' |
17 | protected where: string | 17 | protected where: string |
18 | 18 | ||
19 | protected tables: VideoTables | 19 | protected tables: VideoTableAttributes |
20 | 20 | ||
21 | constructor (protected readonly mode: 'list' | 'get') { | 21 | constructor (protected readonly mode: 'list' | 'get') { |
22 | super() | 22 | super() |
23 | 23 | ||
24 | this.tables = new VideoTables(this.mode) | 24 | this.tables = new VideoTableAttributes(this.mode) |
25 | } | 25 | } |
26 | 26 | ||
27 | protected buildSelect () { | 27 | protected buildSelect () { |
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 6b15c3b69..3eb3dc07d 100644 --- a/server/models/video/sql/shared/video-file-query-builder.ts +++ b/server/models/video/sql/shared/video-file-query-builder.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import { Sequelize } from 'sequelize' | 1 | import { Sequelize } from 'sequelize' |
2 | import { BuildVideoGetQueryOptions } from '../video-model-get-query-builder' | 2 | import { BuildVideoGetQueryOptions } from '../video-model-get-query-builder' |
3 | import { AbstractVideosModelQueryBuilder } from './abstract-videos-model-query-builder' | 3 | import { AbstractVideoQueryBuilder } from './abstract-video-query-builder' |
4 | 4 | ||
5 | /** | 5 | /** |
6 | * | 6 | * |
@@ -8,7 +8,7 @@ import { AbstractVideosModelQueryBuilder } from './abstract-videos-model-query-b | |||
8 | * | 8 | * |
9 | */ | 9 | */ |
10 | 10 | ||
11 | export class VideoFileQueryBuilder extends AbstractVideosModelQueryBuilder { | 11 | export class VideoFileQueryBuilder extends AbstractVideoQueryBuilder { |
12 | protected attributes: { [key: string]: string } | 12 | protected attributes: { [key: string]: string } |
13 | 13 | ||
14 | constructor (protected readonly sequelize: Sequelize) { | 14 | constructor (protected readonly sequelize: Sequelize) { |
diff --git a/server/models/video/sql/shared/video-model-builder.ts b/server/models/video/sql/shared/video-model-builder.ts index 0eac95661..7751d8e68 100644 --- a/server/models/video/sql/shared/video-model-builder.ts +++ b/server/models/video/sql/shared/video-model-builder.ts | |||
@@ -18,7 +18,7 @@ import { VideoChannelModel } from '../../video-channel' | |||
18 | import { VideoFileModel } from '../../video-file' | 18 | import { VideoFileModel } from '../../video-file' |
19 | import { VideoLiveModel } from '../../video-live' | 19 | import { VideoLiveModel } from '../../video-live' |
20 | import { VideoStreamingPlaylistModel } from '../../video-streaming-playlist' | 20 | import { VideoStreamingPlaylistModel } from '../../video-streaming-playlist' |
21 | import { VideoTables } from './video-tables' | 21 | import { VideoTableAttributes } from './video-table-attributes' |
22 | 22 | ||
23 | type SQLRow = { [id: string]: string | number } | 23 | type SQLRow = { [id: string]: string | number } |
24 | 24 | ||
@@ -51,7 +51,7 @@ export class VideoModelBuilder { | |||
51 | 51 | ||
52 | constructor ( | 52 | constructor ( |
53 | readonly mode: 'get' | 'list', | 53 | readonly mode: 'get' | 'list', |
54 | readonly tables: VideoTables | 54 | readonly tables: VideoTableAttributes |
55 | ) { | 55 | ) { |
56 | 56 | ||
57 | } | 57 | } |
diff --git a/server/models/video/sql/shared/video-tables.ts b/server/models/video/sql/shared/video-table-attributes.ts index 042b9d5da..8a8d2073a 100644 --- a/server/models/video/sql/shared/video-tables.ts +++ b/server/models/video/sql/shared/video-table-attributes.ts | |||
@@ -4,7 +4,7 @@ | |||
4 | * Class to build video attributes/join names we want to fetch from the database | 4 | * Class to build video attributes/join names we want to fetch from the database |
5 | * | 5 | * |
6 | */ | 6 | */ |
7 | export class VideoTables { | 7 | export class VideoTableAttributes { |
8 | 8 | ||
9 | constructor (readonly mode: 'get' | 'list') { | 9 | constructor (readonly mode: 'get' | 'list') { |
10 | 10 | ||
@@ -93,22 +93,20 @@ export class VideoTables { | |||
93 | } | 93 | } |
94 | 94 | ||
95 | getStreamingPlaylistAttributes () { | 95 | getStreamingPlaylistAttributes () { |
96 | let playlistKeys = [ 'id', 'playlistUrl', 'playlistFilename', 'type' ] | 96 | return [ |
97 | 97 | 'id', | |
98 | if (this.mode === 'get') { | 98 | 'playlistUrl', |
99 | playlistKeys = playlistKeys.concat([ | 99 | 'playlistFilename', |
100 | 'p2pMediaLoaderInfohashes', | 100 | 'type', |
101 | 'p2pMediaLoaderPeerVersion', | 101 | 'p2pMediaLoaderInfohashes', |
102 | 'segmentsSha256Filename', | 102 | 'p2pMediaLoaderPeerVersion', |
103 | 'segmentsSha256Url', | 103 | 'segmentsSha256Filename', |
104 | 'videoId', | 104 | 'segmentsSha256Url', |
105 | 'createdAt', | 105 | 'videoId', |
106 | 'updatedAt', | 106 | 'createdAt', |
107 | 'storage' | 107 | 'updatedAt', |
108 | ]) | 108 | 'storage' |
109 | } | 109 | ] |
110 | |||
111 | return playlistKeys | ||
112 | } | 110 | } |
113 | 111 | ||
114 | getUserHistoryAttributes () { | 112 | getUserHistoryAttributes () { |