diff options
author | Chocobozzz <me@florianbigard.com> | 2020-11-03 15:33:30 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2020-11-09 15:33:04 +0100 |
commit | 97969c4edf51b37eee691adba43368bb0fbb729b (patch) | |
tree | c1089f898fb936d75651630afcf406995eeb9fba /server/models | |
parent | af4ae64f6faf38f8179f2e07d3cd4ad60006be92 (diff) | |
download | PeerTube-97969c4edf51b37eee691adba43368bb0fbb729b.tar.gz PeerTube-97969c4edf51b37eee691adba43368bb0fbb729b.tar.zst PeerTube-97969c4edf51b37eee691adba43368bb0fbb729b.zip |
Add check constraints live tests
Diffstat (limited to 'server/models')
-rw-r--r-- | server/models/account/user.ts | 3 | ||||
-rw-r--r-- | server/models/video/video-file.ts | 8 | ||||
-rw-r--r-- | server/models/video/video.ts | 2 |
3 files changed, 10 insertions, 3 deletions
diff --git a/server/models/account/user.ts b/server/models/account/user.ts index f64568c54..2aa6469fb 100644 --- a/server/models/account/user.ts +++ b/server/models/account/user.ts | |||
@@ -26,7 +26,6 @@ import { | |||
26 | MUser, | 26 | MUser, |
27 | MUserDefault, | 27 | MUserDefault, |
28 | MUserFormattable, | 28 | MUserFormattable, |
29 | MUserId, | ||
30 | MUserNotifSettingChannelDefault, | 29 | MUserNotifSettingChannelDefault, |
31 | MUserWithNotificationSetting, | 30 | MUserWithNotificationSetting, |
32 | MVideoFullLight | 31 | MVideoFullLight |
@@ -68,10 +67,10 @@ import { getSort, throwIfNotValid } from '../utils' | |||
68 | import { VideoModel } from '../video/video' | 67 | import { VideoModel } from '../video/video' |
69 | import { VideoChannelModel } from '../video/video-channel' | 68 | import { VideoChannelModel } from '../video/video-channel' |
70 | import { VideoImportModel } from '../video/video-import' | 69 | import { VideoImportModel } from '../video/video-import' |
70 | import { VideoLiveModel } from '../video/video-live' | ||
71 | import { VideoPlaylistModel } from '../video/video-playlist' | 71 | import { VideoPlaylistModel } from '../video/video-playlist' |
72 | import { AccountModel } from './account' | 72 | import { AccountModel } from './account' |
73 | import { UserNotificationSettingModel } from './user-notification-setting' | 73 | import { UserNotificationSettingModel } from './user-notification-setting' |
74 | import { VideoLiveModel } from '../video/video-live' | ||
75 | 74 | ||
76 | enum ScopeNames { | 75 | enum ScopeNames { |
77 | FOR_ME_API = 'FOR_ME_API', | 76 | FOR_ME_API = 'FOR_ME_API', |
diff --git a/server/models/video/video-file.ts b/server/models/video/video-file.ts index 6a321917c..8c8fc0b51 100644 --- a/server/models/video/video-file.ts +++ b/server/models/video/video-file.ts | |||
@@ -311,6 +311,14 @@ export class VideoFileModel extends Model<VideoFileModel> { | |||
311 | return element.save({ transaction }) | 311 | return element.save({ transaction }) |
312 | } | 312 | } |
313 | 313 | ||
314 | static removeHLSFilesOfVideoId (videoStreamingPlaylistId: number) { | ||
315 | const options = { | ||
316 | where: { videoStreamingPlaylistId } | ||
317 | } | ||
318 | |||
319 | return VideoFileModel.destroy(options) | ||
320 | } | ||
321 | |||
314 | getVideoOrStreamingPlaylist (this: MVideoFileVideo | MVideoFileStreamingPlaylistVideo): MVideo | MStreamingPlaylistVideo { | 322 | getVideoOrStreamingPlaylist (this: MVideoFileVideo | MVideoFileStreamingPlaylistVideo): MVideo | MStreamingPlaylistVideo { |
315 | if (this.videoId) return (this as MVideoFileVideo).Video | 323 | if (this.videoId) return (this as MVideoFileVideo).Video |
316 | 324 | ||
diff --git a/server/models/video/video.ts b/server/models/video/video.ts index aba8c8cf4..7e008f7ea 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts | |||
@@ -249,7 +249,7 @@ export type AvailableForListIDsOptions = { | |||
249 | [ScopeNames.WITH_LIVE]: { | 249 | [ScopeNames.WITH_LIVE]: { |
250 | include: [ | 250 | include: [ |
251 | { | 251 | { |
252 | model: VideoLiveModel, | 252 | model: VideoLiveModel.unscoped(), |
253 | required: false | 253 | required: false |
254 | } | 254 | } |
255 | ] | 255 | ] |