2019-08-15 04:53:26 -05:00
|
|
|
import { VideoModel } from '../../../models/video/video'
|
|
|
|
import { PickWith, PickWithOpt } from '../../utils'
|
2019-08-20 12:05:31 -05:00
|
|
|
import {
|
|
|
|
MChannelAccountDefault,
|
|
|
|
MChannelAccountLight,
|
|
|
|
MChannelAccountSummaryFormattable,
|
|
|
|
MChannelActor,
|
|
|
|
MChannelFormattable,
|
|
|
|
MChannelUserId
|
|
|
|
} from './video-channels'
|
2019-08-15 04:53:26 -05:00
|
|
|
import { MTag } from './tag'
|
|
|
|
import { MVideoCaptionLanguage } from './video-caption'
|
2019-08-21 07:31:57 -05:00
|
|
|
import { MStreamingPlaylist, MStreamingPlaylistRedundancies, MStreamingPlaylistRedundanciesOpt } from './video-streaming-playlist'
|
2019-08-15 04:53:26 -05:00
|
|
|
import { MVideoFile, MVideoFileRedundanciesOpt } from './video-file'
|
|
|
|
import { MThumbnail } from './thumbnail'
|
2019-08-20 12:05:31 -05:00
|
|
|
import { MVideoBlacklist, MVideoBlacklistLight, MVideoBlacklistUnfederated } from './video-blacklist'
|
2019-08-15 04:53:26 -05:00
|
|
|
import { MScheduleVideoUpdate } from './schedule-video-update'
|
|
|
|
import { MUserVideoHistoryTime } from '../user/user-video-history'
|
|
|
|
|
2019-08-20 06:52:49 -05:00
|
|
|
type Use<K extends keyof VideoModel, M> = PickWith<VideoModel, K, M>
|
|
|
|
|
|
|
|
// ############################################################################
|
|
|
|
|
2019-08-15 04:53:26 -05:00
|
|
|
export type MVideo = Omit<VideoModel, 'VideoChannel' | 'Tags' | 'Thumbnails' | 'VideoPlaylistElements' | 'VideoAbuses' |
|
|
|
|
'VideoFiles' | 'VideoStreamingPlaylists' | 'VideoShares' | 'AccountVideoRates' | 'VideoComments' | 'VideoViews' | 'UserVideoHistories' |
|
|
|
|
'ScheduleVideoUpdate' | 'VideoBlacklist' | 'VideoImport' | 'VideoCaptions'>
|
|
|
|
|
2019-08-20 06:52:49 -05:00
|
|
|
// ############################################################################
|
|
|
|
|
2019-08-15 04:53:26 -05:00
|
|
|
export type MVideoId = Pick<MVideo, 'id'>
|
|
|
|
export type MVideoUrl = Pick<MVideo, 'url'>
|
|
|
|
export type MVideoUUID = Pick<MVideo, 'uuid'>
|
|
|
|
|
|
|
|
export type MVideoIdUrl = MVideoId & MVideoUrl
|
|
|
|
export type MVideoFeed = Pick<MVideo, 'name' | 'uuid'>
|
|
|
|
|
2019-08-20 06:52:49 -05:00
|
|
|
// ############################################################################
|
|
|
|
|
|
|
|
// Video raw associations: schedules, video files, tags, thumbnails, captions, streaming playlists
|
|
|
|
|
|
|
|
// "With" to not confuse with the VideoFile model
|
2019-08-15 04:53:26 -05:00
|
|
|
export type MVideoWithFile = MVideo &
|
2019-08-20 06:52:49 -05:00
|
|
|
Use<'VideoFiles', MVideoFile[]>
|
2019-08-15 04:53:26 -05:00
|
|
|
|
|
|
|
export type MVideoThumbnail = MVideo &
|
2019-08-20 06:52:49 -05:00
|
|
|
Use<'Thumbnails', MThumbnail[]>
|
|
|
|
|
|
|
|
export type MVideoIdThumbnail = MVideoId &
|
|
|
|
Use<'Thumbnails', MThumbnail[]>
|
|
|
|
|
|
|
|
export type MVideoWithFileThumbnail = MVideo &
|
|
|
|
Use<'VideoFiles', MVideoFile[]> &
|
|
|
|
Use<'Thumbnails', MThumbnail[]>
|
2019-08-15 04:53:26 -05:00
|
|
|
|
2019-08-22 03:46:54 -05:00
|
|
|
export type MVideoThumbnailBlacklist = MVideo &
|
|
|
|
Use<'Thumbnails', MThumbnail[]> &
|
|
|
|
Use<'VideoBlacklist', MVideoBlacklistLight>
|
|
|
|
|
2019-08-15 04:53:26 -05:00
|
|
|
export type MVideoTag = MVideo &
|
2019-08-20 06:52:49 -05:00
|
|
|
Use<'Tags', MTag[]>
|
2019-08-15 04:53:26 -05:00
|
|
|
|
|
|
|
export type MVideoWithSchedule = MVideo &
|
|
|
|
PickWithOpt<VideoModel, 'ScheduleVideoUpdate', MScheduleVideoUpdate>
|
|
|
|
|
2019-08-20 06:52:49 -05:00
|
|
|
export type MVideoWithCaptions = MVideo &
|
|
|
|
Use<'VideoCaptions', MVideoCaptionLanguage[]>
|
2019-08-15 04:53:26 -05:00
|
|
|
|
2019-08-20 06:52:49 -05:00
|
|
|
export type MVideoWithStreamingPlaylist = MVideo &
|
|
|
|
Use<'VideoStreamingPlaylists', MStreamingPlaylist[]>
|
2019-08-15 04:53:26 -05:00
|
|
|
|
2019-08-20 06:52:49 -05:00
|
|
|
// ############################################################################
|
|
|
|
|
|
|
|
// Associations with not all their attributes
|
|
|
|
|
|
|
|
export type MVideoUserHistory = MVideo &
|
|
|
|
Use<'UserVideoHistories', MUserVideoHistoryTime[]>
|
2019-08-15 04:53:26 -05:00
|
|
|
|
|
|
|
export type MVideoWithBlacklistLight = MVideo &
|
2019-08-20 06:52:49 -05:00
|
|
|
Use<'VideoBlacklist', MVideoBlacklistLight>
|
2019-08-15 04:53:26 -05:00
|
|
|
|
|
|
|
export type MVideoAccountLight = MVideo &
|
2019-08-20 06:52:49 -05:00
|
|
|
Use<'VideoChannel', MChannelAccountLight>
|
2019-08-15 04:53:26 -05:00
|
|
|
|
2019-08-20 06:52:49 -05:00
|
|
|
export type MVideoWithRights = MVideo &
|
|
|
|
Use<'VideoBlacklist', MVideoBlacklistLight> &
|
|
|
|
Use<'Thumbnails', MThumbnail[]> &
|
|
|
|
Use<'VideoChannel', MChannelUserId>
|
2019-08-15 04:53:26 -05:00
|
|
|
|
2019-08-20 06:52:49 -05:00
|
|
|
// ############################################################################
|
2019-08-15 04:53:26 -05:00
|
|
|
|
2019-08-20 06:52:49 -05:00
|
|
|
// All files with some additional associations
|
2019-08-15 04:53:26 -05:00
|
|
|
|
2019-08-20 06:52:49 -05:00
|
|
|
export type MVideoWithAllFiles = MVideo &
|
|
|
|
Use<'VideoFiles', MVideoFile[]> &
|
|
|
|
Use<'Thumbnails', MThumbnail[]> &
|
|
|
|
Use<'VideoStreamingPlaylists', MStreamingPlaylist[]>
|
2019-08-15 04:53:26 -05:00
|
|
|
|
2019-08-20 06:52:49 -05:00
|
|
|
export type MVideoAccountLightBlacklistAllFiles = MVideo &
|
|
|
|
Use<'VideoFiles', MVideoFile[]> &
|
|
|
|
Use<'Thumbnails', MThumbnail[]> &
|
|
|
|
Use<'VideoStreamingPlaylists', MStreamingPlaylist[]> &
|
|
|
|
Use<'VideoChannel', MChannelAccountLight> &
|
|
|
|
Use<'VideoBlacklist', MVideoBlacklistLight>
|
2019-08-15 04:53:26 -05:00
|
|
|
|
2019-08-20 06:52:49 -05:00
|
|
|
// ############################################################################
|
|
|
|
|
|
|
|
// With account
|
2019-08-15 04:53:26 -05:00
|
|
|
|
|
|
|
export type MVideoAccountDefault = MVideo &
|
2019-08-20 06:52:49 -05:00
|
|
|
Use<'VideoChannel', MChannelAccountDefault>
|
2019-08-15 04:53:26 -05:00
|
|
|
|
2019-08-20 06:52:49 -05:00
|
|
|
export type MVideoThumbnailAccountDefault = MVideo &
|
|
|
|
Use<'Thumbnails', MThumbnail[]> &
|
|
|
|
Use<'VideoChannel', MChannelAccountDefault>
|
2019-08-15 04:53:26 -05:00
|
|
|
|
|
|
|
export type MVideoWithChannelActor = MVideo &
|
2019-08-20 06:52:49 -05:00
|
|
|
Use<'VideoChannel', MChannelActor>
|
|
|
|
|
|
|
|
export type MVideoFullLight = MVideo &
|
|
|
|
Use<'Thumbnails', MThumbnail[]> &
|
|
|
|
Use<'VideoBlacklist', MVideoBlacklistLight> &
|
|
|
|
Use<'Tags', MTag[]> &
|
|
|
|
Use<'VideoChannel', MChannelAccountLight> &
|
|
|
|
Use<'UserVideoHistories', MUserVideoHistoryTime[]> &
|
|
|
|
Use<'VideoFiles', MVideoFile[]> &
|
|
|
|
Use<'ScheduleVideoUpdate', MScheduleVideoUpdate> &
|
|
|
|
Use<'VideoStreamingPlaylists', MStreamingPlaylist[]>
|
|
|
|
|
|
|
|
// ############################################################################
|
|
|
|
|
|
|
|
// API
|
2019-08-15 04:53:26 -05:00
|
|
|
|
|
|
|
export type MVideoAP = MVideo &
|
2019-08-20 06:52:49 -05:00
|
|
|
Use<'Tags', MTag[]> &
|
|
|
|
Use<'VideoChannel', MChannelAccountLight> &
|
|
|
|
Use<'VideoStreamingPlaylists', MStreamingPlaylist[]> &
|
|
|
|
Use<'VideoCaptions', MVideoCaptionLanguage[]> &
|
|
|
|
Use<'VideoBlacklist', MVideoBlacklistUnfederated> &
|
|
|
|
Use<'VideoFiles', MVideoFileRedundanciesOpt[]>
|
2019-08-15 04:53:26 -05:00
|
|
|
|
|
|
|
export type MVideoAPWithoutCaption = Omit<MVideoAP, 'VideoCaptions'>
|
|
|
|
|
|
|
|
export type MVideoDetails = MVideo &
|
2019-08-20 06:52:49 -05:00
|
|
|
Use<'VideoBlacklist', MVideoBlacklistLight> &
|
|
|
|
Use<'Tags', MTag[]> &
|
|
|
|
Use<'VideoChannel', MChannelAccountLight> &
|
|
|
|
Use<'ScheduleVideoUpdate', MScheduleVideoUpdate> &
|
|
|
|
Use<'Thumbnails', MThumbnail[]> &
|
|
|
|
Use<'UserVideoHistories', MUserVideoHistoryTime[]> &
|
|
|
|
Use<'VideoStreamingPlaylists', MStreamingPlaylistRedundancies[]> &
|
|
|
|
Use<'VideoFiles', MVideoFileRedundanciesOpt[]>
|
|
|
|
|
|
|
|
export type MVideoForUser = MVideo &
|
|
|
|
Use<'VideoChannel', MChannelAccountDefault> &
|
|
|
|
Use<'ScheduleVideoUpdate', MScheduleVideoUpdate> &
|
|
|
|
Use<'VideoBlacklist', MVideoBlacklistLight> &
|
|
|
|
Use<'Thumbnails', MThumbnail[]>
|
2019-08-20 12:05:31 -05:00
|
|
|
|
|
|
|
// ############################################################################
|
|
|
|
|
|
|
|
// 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[]> &
|
2019-08-21 07:31:57 -05:00
|
|
|
Use<'VideoStreamingPlaylists', MStreamingPlaylistRedundanciesOpt[]> &
|
2019-08-20 12:05:31 -05:00
|
|
|
Use<'VideoFiles', MVideoFileRedundanciesOpt[]>
|