diff options
author | Chocobozzz <me@florianbigard.com> | 2020-12-08 14:30:29 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2020-12-09 11:41:22 +0100 |
commit | b49f22d8f9a52ab75fd38db2d377249eb58fa678 (patch) | |
tree | a2825877d7b3b53454804a79c9d2a14c5d37385c /server/helpers/video.ts | |
parent | 6c8c15f914cd375da1db5d0cd4d924a86c53d4c1 (diff) | |
download | PeerTube-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.ts | 25 |
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 @@ | |||
1 | import * as Bluebird from 'bluebird' | ||
2 | import { Response } from 'express' | 1 | import { Response } from 'express' |
3 | import { CONFIG } from '@server/initializers/config' | 2 | import { CONFIG } from '@server/initializers/config' |
4 | import { DEFAULT_AUDIO_RESOLUTION } from '@server/initializers/constants' | 3 | import { DEFAULT_AUDIO_RESOLUTION } from '@server/initializers/constants' |
@@ -20,21 +19,21 @@ import { VideoModel } from '../models/video/video' | |||
20 | 19 | ||
21 | type VideoFetchType = 'all' | 'only-video' | 'only-video-with-rights' | 'id' | 'none' | 'only-immutable-attributes' | 20 | type VideoFetchType = 'all' | 'only-video' | 'only-video-with-rights' | 'id' | 'none' | 'only-immutable-attributes' |
22 | 21 | ||
23 | function fetchVideo (id: number | string, fetchType: 'all', userId?: number): Bluebird<MVideoFullLight> | 22 | function fetchVideo (id: number | string, fetchType: 'all', userId?: number): Promise<MVideoFullLight> |
24 | function fetchVideo (id: number | string, fetchType: 'only-immutable-attributes'): Bluebird<MVideoImmutable> | 23 | function fetchVideo (id: number | string, fetchType: 'only-immutable-attributes'): Promise<MVideoImmutable> |
25 | function fetchVideo (id: number | string, fetchType: 'only-video', userId?: number): Bluebird<MVideoThumbnail> | 24 | function fetchVideo (id: number | string, fetchType: 'only-video', userId?: number): Promise<MVideoThumbnail> |
26 | function fetchVideo (id: number | string, fetchType: 'only-video-with-rights', userId?: number): Bluebird<MVideoWithRights> | 25 | function fetchVideo (id: number | string, fetchType: 'only-video-with-rights', userId?: number): Promise<MVideoWithRights> |
27 | function fetchVideo (id: number | string, fetchType: 'id' | 'none', userId?: number): Bluebird<MVideoIdThumbnail> | 26 | function fetchVideo (id: number | string, fetchType: 'id' | 'none', userId?: number): Promise<MVideoIdThumbnail> |
28 | function fetchVideo ( | 27 | function 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> |
33 | function fetchVideo ( | 32 | function 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 | ||
49 | type VideoFetchByUrlType = 'all' | 'only-video' | 'only-immutable-attributes' | 48 | type VideoFetchByUrlType = 'all' | 'only-video' | 'only-immutable-attributes' |
50 | 49 | ||
51 | function fetchVideoByUrl (url: string, fetchType: 'all'): Bluebird<MVideoAccountLightBlacklistAllFiles> | 50 | function fetchVideoByUrl (url: string, fetchType: 'all'): Promise<MVideoAccountLightBlacklistAllFiles> |
52 | function fetchVideoByUrl (url: string, fetchType: 'only-immutable-attributes'): Bluebird<MVideoImmutable> | 51 | function fetchVideoByUrl (url: string, fetchType: 'only-immutable-attributes'): Promise<MVideoImmutable> |
53 | function fetchVideoByUrl (url: string, fetchType: 'only-video'): Bluebird<MVideoThumbnail> | 52 | function fetchVideoByUrl (url: string, fetchType: 'only-video'): Promise<MVideoThumbnail> |
54 | function fetchVideoByUrl ( | 53 | function fetchVideoByUrl ( |
55 | url: string, | 54 | url: string, |
56 | fetchType: VideoFetchByUrlType | 55 | fetchType: VideoFetchByUrlType |
57 | ): Bluebird<MVideoAccountLightBlacklistAllFiles | MVideoThumbnail | MVideoImmutable> | 56 | ): Promise<MVideoAccountLightBlacklistAllFiles | MVideoThumbnail | MVideoImmutable> |
58 | function fetchVideoByUrl ( | 57 | function 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) |