]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/typings/models/video/video.ts
Fix tests
[github/Chocobozzz/PeerTube.git] / server / typings / models / video / video.ts
index 914eb7f577d011440cc7d33b18a090da7b34b8ba..bcc5e5028e326a95e23b627e4dace41dac7aac92 100644 (file)
@@ -1,12 +1,24 @@
 import { VideoModel } from '../../../models/video/video'
 import { PickWith, PickWithOpt } from '../../utils'
-import { MChannelAccountDefault, MChannelAccountLight, MChannelActor, MChannelUserId } from './video-channels'
+import {
+  MChannelAccountDefault,
+  MChannelAccountLight,
+  MChannelAccountSummaryFormattable,
+  MChannelActor,
+  MChannelFormattable,
+  MChannelUserId
+} from './video-channels'
 import { MTag } from './tag'
 import { MVideoCaptionLanguage } from './video-caption'
-import { MStreamingPlaylist, MStreamingPlaylistRedundancies } from './video-streaming-playlist'
-import { MVideoFile, MVideoFileRedundanciesOpt } from './video-file'
+import {
+  MStreamingPlaylistFiles,
+  MStreamingPlaylistRedundancies,
+  MStreamingPlaylistRedundanciesAll,
+  MStreamingPlaylistRedundanciesOpt
+} from './video-streaming-playlist'
+import { MVideoFile, MVideoFileRedundanciesAll, MVideoFileRedundanciesOpt } from './video-file'
 import { MThumbnail } from './thumbnail'
-import { MVideoBlacklistLight, MVideoBlacklistUnfederated } from './video-blacklist'
+import { MVideoBlacklist, MVideoBlacklistLight, MVideoBlacklistUnfederated } from './video-blacklist'
 import { MScheduleVideoUpdate } from './schedule-video-update'
 import { MUserVideoHistoryTime } from '../user/user-video-history'
 
@@ -33,7 +45,8 @@ export type MVideoFeed = Pick<MVideo, 'name' | 'uuid'>
 
 // "With" to not confuse with the VideoFile model
 export type MVideoWithFile = MVideo &
-  Use<'VideoFiles', MVideoFile[]>
+  Use<'VideoFiles', MVideoFile[]> &
+  Use<'VideoStreamingPlaylists', MStreamingPlaylistFiles[]>
 
 export type MVideoThumbnail = MVideo &
   Use<'Thumbnails', MThumbnail[]>
@@ -45,6 +58,10 @@ export type MVideoWithFileThumbnail = MVideo &
   Use<'VideoFiles', MVideoFile[]> &
   Use<'Thumbnails', MThumbnail[]>
 
+export type MVideoThumbnailBlacklist = MVideo &
+  Use<'Thumbnails', MThumbnail[]> &
+  Use<'VideoBlacklist', MVideoBlacklistLight>
+
 export type MVideoTag = MVideo &
   Use<'Tags', MTag[]>
 
@@ -55,7 +72,7 @@ export type MVideoWithCaptions = MVideo &
   Use<'VideoCaptions', MVideoCaptionLanguage[]>
 
 export type MVideoWithStreamingPlaylist = MVideo &
-  Use<'VideoStreamingPlaylists', MStreamingPlaylist[]>
+  Use<'VideoStreamingPlaylists', MStreamingPlaylistFiles[]>
 
 // ############################################################################
 
@@ -82,12 +99,12 @@ export type MVideoWithRights = MVideo &
 export type MVideoWithAllFiles = MVideo &
   Use<'VideoFiles', MVideoFile[]> &
   Use<'Thumbnails', MThumbnail[]> &
-  Use<'VideoStreamingPlaylists', MStreamingPlaylist[]>
+  Use<'VideoStreamingPlaylists', MStreamingPlaylistFiles[]>
 
 export type MVideoAccountLightBlacklistAllFiles = MVideo &
   Use<'VideoFiles', MVideoFile[]> &
   Use<'Thumbnails', MThumbnail[]> &
-  Use<'VideoStreamingPlaylists', MStreamingPlaylist[]> &
+  Use<'VideoStreamingPlaylists', MStreamingPlaylistFiles[]> &
   Use<'VideoChannel', MChannelAccountLight> &
   Use<'VideoBlacklist', MVideoBlacklistLight>
 
@@ -113,7 +130,7 @@ export type MVideoFullLight = MVideo &
   Use<'UserVideoHistories', MUserVideoHistoryTime[]> &
   Use<'VideoFiles', MVideoFile[]> &
   Use<'ScheduleVideoUpdate', MScheduleVideoUpdate> &
-  Use<'VideoStreamingPlaylists', MStreamingPlaylist[]>
+  Use<'VideoStreamingPlaylists', MStreamingPlaylistFiles[]>
 
 // ############################################################################
 
@@ -122,10 +139,11 @@ export type MVideoFullLight = MVideo &
 export type MVideoAP = MVideo &
   Use<'Tags', MTag[]> &
   Use<'VideoChannel', MChannelAccountLight> &
-  Use<'VideoStreamingPlaylists', MStreamingPlaylist[]> &
+  Use<'VideoStreamingPlaylists', MStreamingPlaylistFiles[]> &
   Use<'VideoCaptions', MVideoCaptionLanguage[]> &
   Use<'VideoBlacklist', MVideoBlacklistUnfederated> &
-  Use<'VideoFiles', MVideoFileRedundanciesOpt[]>
+  Use<'VideoFiles', MVideoFileRedundanciesOpt[]> &
+  Use<'Thumbnails', MThumbnail[]>
 
 export type MVideoAPWithoutCaption = Omit<MVideoAP, 'VideoCaptions'>
 
@@ -144,3 +162,23 @@ export type MVideoForUser = MVideo &
   Use<'ScheduleVideoUpdate', MScheduleVideoUpdate> &
   Use<'VideoBlacklist', MVideoBlacklistLight> &
   Use<'Thumbnails', MThumbnail[]>
+
+export type MVideoForRedundancyAPI = MVideo &
+  Use<'VideoFiles', MVideoFileRedundanciesAll[]> &
+  Use<'VideoStreamingPlaylists', MStreamingPlaylistRedundanciesAll[]>
+
+// ############################################################################
+
+// Format for API or AP object
+
+export type MVideoFormattable = MVideo &
+  PickWithOpt<VideoModel, 'UserVideoHistories', MUserVideoHistoryTime[]> &
+  Use<'VideoChannel', MChannelAccountSummaryFormattable> &
+  PickWithOpt<VideoModel, 'ScheduleVideoUpdate', Pick<MScheduleVideoUpdate, 'updateAt' | 'privacy'>> &
+  PickWithOpt<VideoModel, 'VideoBlacklist', Pick<MVideoBlacklist, 'reason'>>
+
+export type MVideoFormattableDetails = MVideoFormattable &
+  Use<'VideoChannel', MChannelFormattable> &
+  Use<'Tags', MTag[]> &
+  Use<'VideoStreamingPlaylists', MStreamingPlaylistRedundanciesOpt[]> &
+  Use<'VideoFiles', MVideoFileRedundanciesOpt[]>