diff options
author | Chocobozzz <me@florianbigard.com> | 2019-04-23 09:50:57 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-04-24 16:26:21 +0200 |
commit | 3acc50844047a37698f0618fa235c138e386a053 (patch) | |
tree | e33243bf7fadbcf2df616fc41814245094fd881a /server/models/video/video-caption.ts | |
parent | 1735c825726edaa0af5035cb6cbb0cc0db502c6d (diff) | |
download | PeerTube-3acc50844047a37698f0618fa235c138e386a053.tar.gz PeerTube-3acc50844047a37698f0618fa235c138e386a053.tar.zst PeerTube-3acc50844047a37698f0618fa235c138e386a053.zip |
Upgrade sequelize
Diffstat (limited to 'server/models/video/video-caption.ts')
-rw-r--r-- | server/models/video/video-caption.ts | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/server/models/video/video-caption.ts b/server/models/video/video-caption.ts index 45c60e26b..76243bf48 100644 --- a/server/models/video/video-caption.ts +++ b/server/models/video/video-caption.ts | |||
@@ -12,7 +12,7 @@ import { | |||
12 | Table, | 12 | Table, |
13 | UpdatedAt | 13 | UpdatedAt |
14 | } from 'sequelize-typescript' | 14 | } from 'sequelize-typescript' |
15 | import { throwIfNotValid } from '../utils' | 15 | import { buildWhereIdOrUUID, throwIfNotValid } from '../utils' |
16 | import { VideoModel } from './video' | 16 | import { VideoModel } from './video' |
17 | import { isVideoCaptionLanguageValid } from '../../helpers/custom-validators/video-captions' | 17 | import { isVideoCaptionLanguageValid } from '../../helpers/custom-validators/video-captions' |
18 | import { VideoCaption } from '../../../shared/models/videos/caption/video-caption.model' | 18 | import { VideoCaption } from '../../../shared/models/videos/caption/video-caption.model' |
@@ -26,17 +26,17 @@ export enum ScopeNames { | |||
26 | WITH_VIDEO_UUID_AND_REMOTE = 'WITH_VIDEO_UUID_AND_REMOTE' | 26 | WITH_VIDEO_UUID_AND_REMOTE = 'WITH_VIDEO_UUID_AND_REMOTE' |
27 | } | 27 | } |
28 | 28 | ||
29 | @Scopes({ | 29 | @Scopes(() => ({ |
30 | [ScopeNames.WITH_VIDEO_UUID_AND_REMOTE]: { | 30 | [ScopeNames.WITH_VIDEO_UUID_AND_REMOTE]: { |
31 | include: [ | 31 | include: [ |
32 | { | 32 | { |
33 | attributes: [ 'uuid', 'remote' ], | 33 | attributes: [ 'uuid', 'remote' ], |
34 | model: () => VideoModel.unscoped(), | 34 | model: VideoModel.unscoped(), |
35 | required: true | 35 | required: true |
36 | } | 36 | } |
37 | ] | 37 | ] |
38 | } | 38 | } |
39 | }) | 39 | })) |
40 | 40 | ||
41 | @Table({ | 41 | @Table({ |
42 | tableName: 'videoCaption', | 42 | tableName: 'videoCaption', |
@@ -97,12 +97,9 @@ export class VideoCaptionModel extends Model<VideoCaptionModel> { | |||
97 | const videoInclude = { | 97 | const videoInclude = { |
98 | model: VideoModel.unscoped(), | 98 | model: VideoModel.unscoped(), |
99 | attributes: [ 'id', 'remote', 'uuid' ], | 99 | attributes: [ 'id', 'remote', 'uuid' ], |
100 | where: { } | 100 | where: buildWhereIdOrUUID(videoId) |
101 | } | 101 | } |
102 | 102 | ||
103 | if (typeof videoId === 'string') videoInclude.where['uuid'] = videoId | ||
104 | else videoInclude.where['id'] = videoId | ||
105 | |||
106 | const query = { | 103 | const query = { |
107 | where: { | 104 | where: { |
108 | language | 105 | language |