aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/video.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-12-08 14:30:29 +0100
committerChocobozzz <chocobozzz@cpy.re>2020-12-09 11:41:22 +0100
commitb49f22d8f9a52ab75fd38db2d377249eb58fa678 (patch)
treea2825877d7b3b53454804a79c9d2a14c5d37385c /server/helpers/video.ts
parent6c8c15f914cd375da1db5d0cd4d924a86c53d4c1 (diff)
downloadPeerTube-b49f22d8f9a52ab75fd38db2d377249eb58fa678.tar.gz
PeerTube-b49f22d8f9a52ab75fd38db2d377249eb58fa678.tar.zst
PeerTube-b49f22d8f9a52ab75fd38db2d377249eb58fa678.zip
Upgrade sequelize to v6
Diffstat (limited to 'server/helpers/video.ts')
-rw-r--r--server/helpers/video.ts25
1 files changed, 12 insertions, 13 deletions
diff --git a/server/helpers/video.ts b/server/helpers/video.ts
index 999137c6d..5d1cd7de1 100644
--- a/server/helpers/video.ts
+++ b/server/helpers/video.ts
@@ -1,4 +1,3 @@
1import * as Bluebird from 'bluebird'
2import { Response } from 'express' 1import { Response } from 'express'
3import { CONFIG } from '@server/initializers/config' 2import { CONFIG } from '@server/initializers/config'
4import { DEFAULT_AUDIO_RESOLUTION } from '@server/initializers/constants' 3import { DEFAULT_AUDIO_RESOLUTION } from '@server/initializers/constants'
@@ -20,21 +19,21 @@ import { VideoModel } from '../models/video/video'
20 19
21type VideoFetchType = 'all' | 'only-video' | 'only-video-with-rights' | 'id' | 'none' | 'only-immutable-attributes' 20type VideoFetchType = 'all' | 'only-video' | 'only-video-with-rights' | 'id' | 'none' | 'only-immutable-attributes'
22 21
23function fetchVideo (id: number | string, fetchType: 'all', userId?: number): Bluebird<MVideoFullLight> 22function fetchVideo (id: number | string, fetchType: 'all', userId?: number): Promise<MVideoFullLight>
24function fetchVideo (id: number | string, fetchType: 'only-immutable-attributes'): Bluebird<MVideoImmutable> 23function fetchVideo (id: number | string, fetchType: 'only-immutable-attributes'): Promise<MVideoImmutable>
25function fetchVideo (id: number | string, fetchType: 'only-video', userId?: number): Bluebird<MVideoThumbnail> 24function fetchVideo (id: number | string, fetchType: 'only-video', userId?: number): Promise<MVideoThumbnail>
26function fetchVideo (id: number | string, fetchType: 'only-video-with-rights', userId?: number): Bluebird<MVideoWithRights> 25function fetchVideo (id: number | string, fetchType: 'only-video-with-rights', userId?: number): Promise<MVideoWithRights>
27function fetchVideo (id: number | string, fetchType: 'id' | 'none', userId?: number): Bluebird<MVideoIdThumbnail> 26function fetchVideo (id: number | string, fetchType: 'id' | 'none', userId?: number): Promise<MVideoIdThumbnail>
28function fetchVideo ( 27function fetchVideo (
29 id: number | string, 28 id: number | string,
30 fetchType: VideoFetchType, 29 fetchType: VideoFetchType,
31 userId?: number 30 userId?: number
32): Bluebird<MVideoFullLight | MVideoThumbnail | MVideoWithRights | MVideoIdThumbnail | MVideoImmutable> 31): Promise<MVideoFullLight | MVideoThumbnail | MVideoWithRights | MVideoIdThumbnail | MVideoImmutable>
33function fetchVideo ( 32function fetchVideo (
34 id: number | string, 33 id: number | string,
35 fetchType: VideoFetchType, 34 fetchType: VideoFetchType,
36 userId?: number 35 userId?: number
37): Bluebird<MVideoFullLight | MVideoThumbnail | MVideoWithRights | MVideoIdThumbnail | MVideoImmutable> { 36): Promise<MVideoFullLight | MVideoThumbnail | MVideoWithRights | MVideoIdThumbnail | MVideoImmutable> {
38 if (fetchType === 'all') return VideoModel.loadAndPopulateAccountAndServerAndTags(id, undefined, userId) 37 if (fetchType === 'all') return VideoModel.loadAndPopulateAccountAndServerAndTags(id, undefined, userId)
39 38
40 if (fetchType === 'only-immutable-attributes') return VideoModel.loadImmutableAttributes(id) 39 if (fetchType === 'only-immutable-attributes') return VideoModel.loadImmutableAttributes(id)
@@ -48,17 +47,17 @@ function fetchVideo (
48 47
49type VideoFetchByUrlType = 'all' | 'only-video' | 'only-immutable-attributes' 48type VideoFetchByUrlType = 'all' | 'only-video' | 'only-immutable-attributes'
50 49
51function fetchVideoByUrl (url: string, fetchType: 'all'): Bluebird<MVideoAccountLightBlacklistAllFiles> 50function fetchVideoByUrl (url: string, fetchType: 'all'): Promise<MVideoAccountLightBlacklistAllFiles>
52function fetchVideoByUrl (url: string, fetchType: 'only-immutable-attributes'): Bluebird<MVideoImmutable> 51function fetchVideoByUrl (url: string, fetchType: 'only-immutable-attributes'): Promise<MVideoImmutable>
53function fetchVideoByUrl (url: string, fetchType: 'only-video'): Bluebird<MVideoThumbnail> 52function fetchVideoByUrl (url: string, fetchType: 'only-video'): Promise<MVideoThumbnail>
54function fetchVideoByUrl ( 53function fetchVideoByUrl (
55 url: string, 54 url: string,
56 fetchType: VideoFetchByUrlType 55 fetchType: VideoFetchByUrlType
57): Bluebird<MVideoAccountLightBlacklistAllFiles | MVideoThumbnail | MVideoImmutable> 56): Promise<MVideoAccountLightBlacklistAllFiles | MVideoThumbnail | MVideoImmutable>
58function fetchVideoByUrl ( 57function fetchVideoByUrl (
59 url: string, 58 url: string,
60 fetchType: VideoFetchByUrlType 59 fetchType: VideoFetchByUrlType
61): Bluebird<MVideoAccountLightBlacklistAllFiles | MVideoThumbnail | MVideoImmutable> { 60): Promise<MVideoAccountLightBlacklistAllFiles | MVideoThumbnail | MVideoImmutable> {
62 if (fetchType === 'all') return VideoModel.loadByUrlAndPopulateAccount(url) 61 if (fetchType === 'all') return VideoModel.loadByUrlAndPopulateAccount(url)
63 62
64 if (fetchType === 'only-immutable-attributes') return VideoModel.loadByUrlImmutableAttributes(url) 63 if (fetchType === 'only-immutable-attributes') return VideoModel.loadByUrlImmutableAttributes(url)