aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video/sql/shared/video-file-query-builder.ts
diff options
context:
space:
mode:
authorkontrollanten <6680299+kontrollanten@users.noreply.github.com>2022-02-28 08:34:43 +0100
committerGitHub <noreply@github.com>2022-02-28 08:34:43 +0100
commitd0800f7661f13fabe7bb6f4aa0ea50764f106405 (patch)
treed43e6b0b6f4a5a32e03487e6464edbcaf288be2a /server/models/video/sql/shared/video-file-query-builder.ts
parent5cad2ca9db9b9d138f8a33058d10b94a9fd50c69 (diff)
downloadPeerTube-d0800f7661f13fabe7bb6f4aa0ea50764f106405.tar.gz
PeerTube-d0800f7661f13fabe7bb6f4aa0ea50764f106405.tar.zst
PeerTube-d0800f7661f13fabe7bb6f4aa0ea50764f106405.zip
Implement avatar miniatures (#4639)
* client: remove unused file * refactor(client/my-actor-avatar): size from input Read size from component input instead of scss, to make it possible to use smaller avatar images when implemented. * implement avatar miniatures close #4560 * fix(test): max file size * fix(search-index): normalize res acc to avatarMini * refactor avatars to an array * client/search: resize channel avatar to 120 * refactor(client/videos): remove unused function * client(actor-avatar): set default size * fix tests and avatars full result When findOne is used only an array containting one avatar is returned. * update migration version and version notations * server/search: harmonize normalizing * Cleanup avatar miniature PR Co-authored-by: Chocobozzz <me@florianbigard.com>
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.ts69
1 files changed, 0 insertions, 69 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
deleted file mode 100644
index 3eb3dc07d..000000000
--- a/server/models/video/sql/shared/video-file-query-builder.ts
+++ /dev/null
@@ -1,69 +0,0 @@
1import { Sequelize } from 'sequelize'
2import { BuildVideoGetQueryOptions } from '../video-model-get-query-builder'
3import { AbstractVideoQueryBuilder } from './abstract-video-query-builder'
4
5/**
6 *
7 * Fetch files (webtorrent and streaming playlist) according to a video
8 *
9 */
10
11export class VideoFileQueryBuilder extends AbstractVideoQueryBuilder {
12 protected attributes: { [key: string]: string }
13
14 constructor (protected readonly sequelize: Sequelize) {
15 super('get')
16 }
17
18 queryWebTorrentVideos (options: BuildVideoGetQueryOptions) {
19 this.buildWebtorrentFilesQuery(options)
20
21 return this.runQuery(options)
22 }
23
24 queryStreamingPlaylistVideos (options: BuildVideoGetQueryOptions) {
25 this.buildVideoStreamingPlaylistFilesQuery(options)
26
27 return this.runQuery(options)
28 }
29
30 private buildWebtorrentFilesQuery (options: BuildVideoGetQueryOptions) {
31 this.attributes = {
32 '"video"."id"': ''
33 }
34
35 this.includeWebtorrentFiles()
36
37 if (this.shouldIncludeRedundancies(options)) {
38 this.includeWebTorrentRedundancies()
39 }
40
41 this.whereId(options)
42
43 this.query = this.buildQuery()
44 }
45
46 private buildVideoStreamingPlaylistFilesQuery (options: BuildVideoGetQueryOptions) {
47 this.attributes = {
48 '"video"."id"': ''
49 }
50
51 this.includeStreamingPlaylistFiles()
52
53 if (this.shouldIncludeRedundancies(options)) {
54 this.includeStreamingPlaylistRedundancies()
55 }
56
57 this.whereId(options)
58
59 this.query = this.buildQuery()
60 }
61
62 private buildQuery () {
63 return `${this.buildSelect()} FROM "video" ${this.joins} ${this.where}`
64 }
65
66 private shouldIncludeRedundancies (options: BuildVideoGetQueryOptions) {
67 return options.type === 'api'
68 }
69}