From 26d6bf6533023326fa017812cf31bbe20c752d36 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 18 Jun 2020 10:45:25 +0200 Subject: Split types and typings --- server/typings/models/video/index.ts | 18 -- .../typings/models/video/schedule-video-update.ts | 19 -- server/typings/models/video/tag.ts | 3 - server/typings/models/video/thumbnail.ts | 3 - server/typings/models/video/video-abuse.ts | 35 ---- server/typings/models/video/video-blacklist.ts | 30 --- server/typings/models/video/video-caption.ts | 27 --- .../typings/models/video/video-change-ownership.ts | 26 --- server/typings/models/video/video-channels.ts | 145 -------------- server/typings/models/video/video-comment.ts | 66 ------- server/typings/models/video/video-file.ts | 43 ----- server/typings/models/video/video-import.ts | 36 ---- .../typings/models/video/video-playlist-element.ts | 39 ---- server/typings/models/video/video-playlist.ts | 104 ---------- server/typings/models/video/video-rate.ts | 27 --- server/typings/models/video/video-redundancy.ts | 43 ----- server/typings/models/video/video-share.ts | 19 -- .../models/video/video-streaming-playlist.ts | 43 ----- server/typings/models/video/video.ts | 211 --------------------- 19 files changed, 937 deletions(-) delete mode 100644 server/typings/models/video/index.ts delete mode 100644 server/typings/models/video/schedule-video-update.ts delete mode 100644 server/typings/models/video/tag.ts delete mode 100644 server/typings/models/video/thumbnail.ts delete mode 100644 server/typings/models/video/video-abuse.ts delete mode 100644 server/typings/models/video/video-blacklist.ts delete mode 100644 server/typings/models/video/video-caption.ts delete mode 100644 server/typings/models/video/video-change-ownership.ts delete mode 100644 server/typings/models/video/video-channels.ts delete mode 100644 server/typings/models/video/video-comment.ts delete mode 100644 server/typings/models/video/video-file.ts delete mode 100644 server/typings/models/video/video-import.ts delete mode 100644 server/typings/models/video/video-playlist-element.ts delete mode 100644 server/typings/models/video/video-playlist.ts delete mode 100644 server/typings/models/video/video-rate.ts delete mode 100644 server/typings/models/video/video-redundancy.ts delete mode 100644 server/typings/models/video/video-share.ts delete mode 100644 server/typings/models/video/video-streaming-playlist.ts delete mode 100644 server/typings/models/video/video.ts (limited to 'server/typings/models/video') diff --git a/server/typings/models/video/index.ts b/server/typings/models/video/index.ts deleted file mode 100644 index bd69c8a4b..000000000 --- a/server/typings/models/video/index.ts +++ /dev/null @@ -1,18 +0,0 @@ -export * from './schedule-video-update' -export * from './tag' -export * from './thumbnail' -export * from './video' -export * from './video-abuse' -export * from './video-blacklist' -export * from './video-caption' -export * from './video-change-ownership' -export * from './video-channels' -export * from './video-comment' -export * from './video-file' -export * from './video-import' -export * from './video-playlist' -export * from './video-playlist-element' -export * from './video-rate' -export * from './video-redundancy' -export * from './video-share' -export * from './video-streaming-playlist' diff --git a/server/typings/models/video/schedule-video-update.ts b/server/typings/models/video/schedule-video-update.ts deleted file mode 100644 index 95a53d139..000000000 --- a/server/typings/models/video/schedule-video-update.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { ScheduleVideoUpdateModel } from '../../../models/video/schedule-video-update' -import { PickWith } from '@server/typings/utils' -import { MVideoAPWithoutCaption, MVideoWithBlacklistLight } from './video' - -type Use = PickWith - -// ############################################################################ - -export type MScheduleVideoUpdate = Omit - -// ############################################################################ - -export type MScheduleVideoUpdateVideoAll = - MScheduleVideoUpdate & - Use<'Video', MVideoAPWithoutCaption & MVideoWithBlacklistLight> - -// Format for API or AP object - -export type MScheduleVideoUpdateFormattable = Pick diff --git a/server/typings/models/video/tag.ts b/server/typings/models/video/tag.ts deleted file mode 100644 index 64a68873e..000000000 --- a/server/typings/models/video/tag.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { TagModel } from '../../../models/video/tag' - -export type MTag = Omit diff --git a/server/typings/models/video/thumbnail.ts b/server/typings/models/video/thumbnail.ts deleted file mode 100644 index c03ba55ac..000000000 --- a/server/typings/models/video/thumbnail.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { ThumbnailModel } from '../../../models/video/thumbnail' - -export type MThumbnail = Omit diff --git a/server/typings/models/video/video-abuse.ts b/server/typings/models/video/video-abuse.ts deleted file mode 100644 index d60f05e4c..000000000 --- a/server/typings/models/video/video-abuse.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { VideoAbuseModel } from '../../../models/video/video-abuse' -import { PickWith } from '../../utils' -import { MVideoAccountLightBlacklistAllFiles, MVideo } from './video' -import { MAccountDefault, MAccountFormattable } from '../account' - -type Use = PickWith - -// ############################################################################ - -export type MVideoAbuse = Omit - -// ############################################################################ - -export type MVideoAbuseId = Pick - -export type MVideoAbuseVideo = - MVideoAbuse & - Pick & - Use<'Video', MVideo> - -export type MVideoAbuseAccountVideo = - MVideoAbuse & - Pick & - Use<'Video', MVideoAccountLightBlacklistAllFiles> & - Use<'Account', MAccountDefault> - -// ############################################################################ - -// Format for API or AP object - -export type MVideoAbuseFormattable = - MVideoAbuse & - Use<'Account', MAccountFormattable> & - Use<'Video', Pick> diff --git a/server/typings/models/video/video-blacklist.ts b/server/typings/models/video/video-blacklist.ts deleted file mode 100644 index ddb4db832..000000000 --- a/server/typings/models/video/video-blacklist.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { VideoBlacklistModel } from '../../../models/video/video-blacklist' -import { PickWith } from '@server/typings/utils' -import { MVideo, MVideoFormattable } from './video' - -type Use = PickWith - -// ############################################################################ - -export type MVideoBlacklist = Omit - -export type MVideoBlacklistLight = Pick -export type MVideoBlacklistUnfederated = Pick - -// ############################################################################ - -export type MVideoBlacklistLightVideo = - MVideoBlacklistLight & - Use<'Video', MVideo> - -export type MVideoBlacklistVideo = - MVideoBlacklist & - Use<'Video', MVideo> - -// ############################################################################ - -// Format for API or AP object - -export type MVideoBlacklistFormattable = - MVideoBlacklist & - Use<'Video', MVideoFormattable> diff --git a/server/typings/models/video/video-caption.ts b/server/typings/models/video/video-caption.ts deleted file mode 100644 index e7aff6956..000000000 --- a/server/typings/models/video/video-caption.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { VideoCaptionModel } from '../../../models/video/video-caption' -import { FunctionProperties, PickWith } from '@server/typings/utils' -import { MVideo, MVideoUUID } from './video' - -type Use = PickWith - -// ############################################################################ - -export type MVideoCaption = Omit - -// ############################################################################ - -export type MVideoCaptionLanguage = Pick -export type MVideoCaptionLanguageUrl = Pick - -export type MVideoCaptionVideo = - MVideoCaption & - Use<'Video', Pick> - -// ############################################################################ - -// Format for API or AP object - -export type MVideoCaptionFormattable = - FunctionProperties & - Pick & - Use<'Video', MVideoUUID> diff --git a/server/typings/models/video/video-change-ownership.ts b/server/typings/models/video/video-change-ownership.ts deleted file mode 100644 index 971dc3db5..000000000 --- a/server/typings/models/video/video-change-ownership.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { VideoChangeOwnershipModel } from '@server/models/video/video-change-ownership' -import { PickWith } from '@server/typings/utils' -import { MAccountDefault, MAccountFormattable } from '../account/account' -import { MVideo, MVideoWithAllFiles } from './video' - -type Use = PickWith - -// ############################################################################ - -export type MVideoChangeOwnership = Omit - -export type MVideoChangeOwnershipFull = - MVideoChangeOwnership & - Use<'Initiator', MAccountDefault> & - Use<'NextOwner', MAccountDefault> & - Use<'Video', MVideoWithAllFiles> - -// ############################################################################ - -// Format for API or AP object - -export type MVideoChangeOwnershipFormattable = - Pick & - Use<'Initiator', MAccountFormattable> & - Use<'NextOwner', MAccountFormattable> & - Use<'Video', Pick> diff --git a/server/typings/models/video/video-channels.ts b/server/typings/models/video/video-channels.ts deleted file mode 100644 index 50f7c2d8a..000000000 --- a/server/typings/models/video/video-channels.ts +++ /dev/null @@ -1,145 +0,0 @@ -import { FunctionProperties, PickWith, PickWithOpt } from '../../utils' -import { VideoChannelModel } from '../../../models/video/video-channel' -import { - MAccountActor, - MAccountAPI, - MAccountDefault, - MAccountFormattable, - MAccountLight, - MAccountSummaryBlocks, - MAccountSummaryFormattable, - MAccountUrl, - MAccountUserId, - MActor, - MActorAccountChannelId, - MActorAP, - MActorAPI, - MActorDefault, - MActorDefaultLight, - MActorFormattable, - MActorLight, - MActorSummary, - MActorSummaryFormattable, MActorUrl -} from '../account' -import { MVideo } from './video' - -type Use = PickWith - -// ############################################################################ - -export type MChannel = Omit - -// ############################################################################ - -export type MChannelId = Pick - -// ############################################################################ - -export type MChannelIdActor = - MChannelId & - Use<'Actor', MActorAccountChannelId> - -export type MChannelUserId = - Pick & - Use<'Account', MAccountUserId> - -export type MChannelActor = - MChannel & - Use<'Actor', MActor> - -export type MChannelUrl = Use<'Actor', MActorUrl> - -// Default scope -export type MChannelDefault = - MChannel & - Use<'Actor', MActorDefault> - -// ############################################################################ - -// Not all association attributes - -export type MChannelLight = - MChannel & - Use<'Actor', MActorDefaultLight> - -export type MChannelActorLight = - MChannel & - Use<'Actor', MActorLight> - -export type MChannelAccountLight = - MChannel & - Use<'Actor', MActorDefaultLight> & - Use<'Account', MAccountLight> - -// ############################################################################ - -// Account associations - -export type MChannelAccountActor = - MChannel & - Use<'Account', MAccountActor> - -export type MChannelAccountDefault = - MChannel & - Use<'Actor', MActorDefault> & - Use<'Account', MAccountDefault> - -export type MChannelActorAccountActor = - MChannel & - Use<'Account', MAccountActor> & - Use<'Actor', MActor> - -// ############################################################################ - -// Videos associations -export type MChannelVideos = - MChannel & - Use<'Videos', MVideo[]> - -export type MChannelActorAccountDefaultVideos = - MChannel & - Use<'Actor', MActorDefault> & - Use<'Account', MAccountDefault> & - Use<'Videos', MVideo[]> - -// ############################################################################ - -// For API - -export type MChannelSummary = - FunctionProperties & - Pick & - Use<'Actor', MActorSummary> - -export type MChannelSummaryAccount = - MChannelSummary & - Use<'Account', MAccountSummaryBlocks> - -export type MChannelAPI = - MChannel & - Use<'Actor', MActorAPI> & - Use<'Account', MAccountAPI> - -// ############################################################################ - -// Format for API or AP object - -export type MChannelSummaryFormattable = - FunctionProperties & - Pick & - Use<'Actor', MActorSummaryFormattable> - -export type MChannelAccountSummaryFormattable = - MChannelSummaryFormattable & - Use<'Account', MAccountSummaryFormattable> - -export type MChannelFormattable = - FunctionProperties & - Pick & - Use<'Actor', MActorFormattable> & - PickWithOpt - -export type MChannelAP = - Pick & - Use<'Actor', MActorAP> & - Use<'Account', MAccountUrl> diff --git a/server/typings/models/video/video-comment.ts b/server/typings/models/video/video-comment.ts deleted file mode 100644 index d6e0b66f5..000000000 --- a/server/typings/models/video/video-comment.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { VideoCommentModel } from '../../../models/video/video-comment' -import { PickWith, PickWithOpt } from '../../utils' -import { MAccountDefault, MAccountFormattable, MAccountUrl } from '../account' -import { MVideoAccountLight, MVideoFeed, MVideoIdUrl, MVideoUrl } from './video' - -type Use = PickWith - -// ############################################################################ - -export type MComment = Omit -export type MCommentTotalReplies = MComment & { totalReplies?: number } -export type MCommentId = Pick -export type MCommentUrl = Pick - -// ############################################################################ - -export type MCommentOwner = - MComment & - Use<'Account', MAccountDefault> - -export type MCommentVideo = - MComment & - Use<'Video', MVideoAccountLight> - -export type MCommentReply = - MComment & - Use<'InReplyToVideoComment', MComment> - -export type MCommentOwnerVideo = - MComment & - Use<'Account', MAccountDefault> & - Use<'Video', MVideoAccountLight> - -export type MCommentOwnerVideoReply = - MComment & - Use<'Account', MAccountDefault> & - Use<'Video', MVideoAccountLight> & - Use<'InReplyToVideoComment', MComment> - -export type MCommentOwnerReplyVideoLight = - MComment & - Use<'Account', MAccountDefault> & - Use<'InReplyToVideoComment', MComment> & - Use<'Video', MVideoIdUrl> - -export type MCommentOwnerVideoFeed = - MCommentOwner & - Use<'Video', MVideoFeed> - -// ############################################################################ - -export type MCommentAPI = MComment & { totalReplies: number } - -// ############################################################################ - -// Format for API or AP object - -export type MCommentFormattable = - MCommentTotalReplies & - Use<'Account', MAccountFormattable> - -export type MCommentAP = - MComment & - Use<'Account', MAccountUrl> & - PickWithOpt & - PickWithOpt diff --git a/server/typings/models/video/video-file.ts b/server/typings/models/video/video-file.ts deleted file mode 100644 index 3fcaca78f..000000000 --- a/server/typings/models/video/video-file.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { VideoFileModel } from '../../../models/video/video-file' -import { PickWith, PickWithOpt } from '../../utils' -import { MVideo, MVideoUUID } from './video' -import { MVideoRedundancy, MVideoRedundancyFileUrl } from './video-redundancy' -import { MStreamingPlaylistVideo, MStreamingPlaylist } from './video-streaming-playlist' - -type Use = PickWith - -// ############################################################################ - -export type MVideoFile = Omit - -export type MVideoFileVideo = - MVideoFile & - Use<'Video', MVideo> - -export type MVideoFileStreamingPlaylist = - MVideoFile & - Use<'VideoStreamingPlaylist', MStreamingPlaylist> - -export type MVideoFileStreamingPlaylistVideo = - MVideoFile & - Use<'VideoStreamingPlaylist', MStreamingPlaylistVideo> - -export type MVideoFileVideoUUID = - MVideoFile & - Use<'Video', MVideoUUID> - -export type MVideoFileRedundanciesAll = - MVideoFile & - PickWithOpt - -export type MVideoFileRedundanciesOpt = - MVideoFile & - PickWithOpt - -export function isStreamingPlaylistFile (file: any): file is MVideoFileStreamingPlaylist { - return !!file.videoStreamingPlaylistId -} - -export function isWebtorrentFile (file: any): file is MVideoFileVideo { - return !!file.videoId -} diff --git a/server/typings/models/video/video-import.ts b/server/typings/models/video/video-import.ts deleted file mode 100644 index 4e5c2e4f0..000000000 --- a/server/typings/models/video/video-import.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { VideoImportModel } from '@server/models/video/video-import' -import { PickWith, PickWithOpt } from '@server/typings/utils' -import { MVideo, MVideoAccountLight, MVideoFormattable, MVideoTag, MVideoThumbnail, MVideoWithFile } from './video' -import { MUser } from '../user/user' - -type Use = PickWith - -// ############################################################################ - -export type MVideoImport = Omit - -export type MVideoImportVideo = - MVideoImport & - Use<'Video', MVideo> - -// ############################################################################ - -type VideoAssociation = MVideoTag & MVideoAccountLight & MVideoThumbnail - -export type MVideoImportDefault = - MVideoImport & - Use<'User', MUser> & - Use<'Video', VideoAssociation> - -export type MVideoImportDefaultFiles = - MVideoImport & - Use<'User', MUser> & - Use<'Video', VideoAssociation & MVideoWithFile> - -// ############################################################################ - -// Format for API or AP object - -export type MVideoImportFormattable = - MVideoImport & - PickWithOpt diff --git a/server/typings/models/video/video-playlist-element.ts b/server/typings/models/video/video-playlist-element.ts deleted file mode 100644 index f33c76594..000000000 --- a/server/typings/models/video/video-playlist-element.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { VideoPlaylistElementModel } from '@server/models/video/video-playlist-element' -import { PickWith } from '@server/typings/utils' -import { MVideoFormattable, MVideoThumbnail, MVideoUrl } from './video' -import { MVideoPlaylistPrivacy } from './video-playlist' - -type Use = PickWith - -// ############################################################################ - -export type MVideoPlaylistElement = Omit - -// ############################################################################ - -export type MVideoPlaylistElementId = Pick - -export type MVideoPlaylistElementLight = Pick - -// ############################################################################ - -export type MVideoPlaylistVideoThumbnail = - MVideoPlaylistElement & - Use<'Video', MVideoThumbnail> - -export type MVideoPlaylistElementVideoUrlPlaylistPrivacy = - MVideoPlaylistElement & - Use<'Video', MVideoUrl> & - Use<'VideoPlaylist', MVideoPlaylistPrivacy> - -// ############################################################################ - -// Format for API or AP object - -export type MVideoPlaylistElementFormattable = - MVideoPlaylistElement & - Use<'Video', MVideoFormattable> - -export type MVideoPlaylistElementAP = - MVideoPlaylistElement & - Use<'Video', MVideoUrl> diff --git a/server/typings/models/video/video-playlist.ts b/server/typings/models/video/video-playlist.ts deleted file mode 100644 index 49c27f4a7..000000000 --- a/server/typings/models/video/video-playlist.ts +++ /dev/null @@ -1,104 +0,0 @@ -import { VideoPlaylistModel } from '../../../models/video/video-playlist' -import { PickWith } from '../../utils' -import { MAccount, MAccountDefault, MAccountSummary, MAccountSummaryFormattable } from '../account' -import { MThumbnail } from './thumbnail' -import { MChannelDefault, MChannelSummary, MChannelSummaryFormattable, MChannelUrl } from './video-channels' -import { MVideoPlaylistElementLight } from '@server/typings/models/video/video-playlist-element' - -type Use = PickWith - -// ############################################################################ - -export type MVideoPlaylist = Omit - -// ############################################################################ - -export type MVideoPlaylistId = Pick -export type MVideoPlaylistPrivacy = Pick -export type MVideoPlaylistUUID = Pick -export type MVideoPlaylistVideosLength = MVideoPlaylist & { videosLength?: number } - -// ############################################################################ - -// With elements - -export type MVideoPlaylistWithElements = - MVideoPlaylist & - Use<'VideoPlaylistElements', MVideoPlaylistElementLight[]> - -export type MVideoPlaylistIdWithElements = - MVideoPlaylistId & - Use<'VideoPlaylistElements', MVideoPlaylistElementLight[]> - -// ############################################################################ - -// With account - -export type MVideoPlaylistOwner = - MVideoPlaylist & - Use<'OwnerAccount', MAccount> - -export type MVideoPlaylistOwnerDefault = - MVideoPlaylist & - Use<'OwnerAccount', MAccountDefault> - -// ############################################################################ - -// With thumbnail - -export type MVideoPlaylistThumbnail = - MVideoPlaylist & - Use<'Thumbnail', MThumbnail> - -export type MVideoPlaylistAccountThumbnail = - MVideoPlaylist & - Use<'OwnerAccount', MAccountDefault> & - Use<'Thumbnail', MThumbnail> - -// ############################################################################ - -// With channel - -export type MVideoPlaylistAccountChannelDefault = - MVideoPlaylist & - Use<'OwnerAccount', MAccountDefault> & - Use<'VideoChannel', MChannelDefault> - -// ############################################################################ - -// With all associations - -export type MVideoPlaylistFull = - MVideoPlaylist & - Use<'OwnerAccount', MAccountDefault> & - Use<'VideoChannel', MChannelDefault> & - Use<'Thumbnail', MThumbnail> - -// ############################################################################ - -// For API - -export type MVideoPlaylistAccountChannelSummary = - MVideoPlaylist & - Use<'OwnerAccount', MAccountSummary> & - Use<'VideoChannel', MChannelSummary> - -export type MVideoPlaylistFullSummary = - MVideoPlaylist & - Use<'Thumbnail', MThumbnail> & - Use<'OwnerAccount', MAccountSummary> & - Use<'VideoChannel', MChannelSummary> - -// ############################################################################ - -// Format for API or AP object - -export type MVideoPlaylistFormattable = - MVideoPlaylistVideosLength & - Use<'OwnerAccount', MAccountSummaryFormattable> & - Use<'VideoChannel', MChannelSummaryFormattable> - -export type MVideoPlaylistAP = - MVideoPlaylist & - Use<'Thumbnail', MThumbnail> & - Use<'VideoChannel', MChannelUrl> diff --git a/server/typings/models/video/video-rate.ts b/server/typings/models/video/video-rate.ts deleted file mode 100644 index 64ce4965b..000000000 --- a/server/typings/models/video/video-rate.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { AccountVideoRateModel } from '@server/models/account/account-video-rate' -import { PickWith } from '@server/typings/utils' -import { MAccountAudience, MAccountUrl } from '../account/account' -import { MVideo, MVideoFormattable } from './video' - -type Use = PickWith - -// ############################################################################ - -export type MAccountVideoRate = Omit - -export type MAccountVideoRateAccountUrl = - MAccountVideoRate & - Use<'Account', MAccountUrl> - -export type MAccountVideoRateAccountVideo = - MAccountVideoRate & - Use<'Account', MAccountAudience> & - Use<'Video', MVideo> - -// ############################################################################ - -// Format for API or AP object - -export type MAccountVideoRateFormattable = - Pick & - Use<'Video', MVideoFormattable> diff --git a/server/typings/models/video/video-redundancy.ts b/server/typings/models/video/video-redundancy.ts deleted file mode 100644 index 5107aa7f4..000000000 --- a/server/typings/models/video/video-redundancy.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { VideoRedundancyModel } from '../../../models/redundancy/video-redundancy' -import { PickWith, PickWithOpt } from '@server/typings/utils' -import { VideoStreamingPlaylistModel } from '@server/models/video/video-streaming-playlist' -import { VideoFileModel } from '@server/models/video/video-file' -import { MVideoFile, MVideoFileVideo } from './video-file' -import { MStreamingPlaylistVideo } from './video-streaming-playlist' -import { MVideoUrl } from './video' - -type Use = PickWith - -// ############################################################################ - -export type MVideoRedundancy = Omit - -export type MVideoRedundancyFileUrl = Pick - -// ############################################################################ - -export type MVideoRedundancyFile = - MVideoRedundancy & - Use<'VideoFile', MVideoFile> - -export type MVideoRedundancyFileVideo = - MVideoRedundancy & - Use<'VideoFile', MVideoFileVideo> - -export type MVideoRedundancyStreamingPlaylistVideo = - MVideoRedundancy & - Use<'VideoStreamingPlaylist', MStreamingPlaylistVideo> - -export type MVideoRedundancyVideo = - MVideoRedundancy & - Use<'VideoFile', MVideoFileVideo> & - Use<'VideoStreamingPlaylist', MStreamingPlaylistVideo> - -// ############################################################################ - -// Format for API or AP object - -export type MVideoRedundancyAP = - MVideoRedundancy & - PickWithOpt> & - PickWithOpt> diff --git a/server/typings/models/video/video-share.ts b/server/typings/models/video/video-share.ts deleted file mode 100644 index 50ca75d26..000000000 --- a/server/typings/models/video/video-share.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { VideoShareModel } from '../../../models/video/video-share' -import { PickWith } from '../../utils' -import { MActorDefault } from '../account' -import { MVideo } from './video' - -type Use = PickWith - -// ############################################################################ - -export type MVideoShare = Omit - -export type MVideoShareActor = - MVideoShare & - Use<'Actor', MActorDefault> - -export type MVideoShareFull = - MVideoShare & - Use<'Actor', MActorDefault> & - Use<'Video', MVideo> diff --git a/server/typings/models/video/video-streaming-playlist.ts b/server/typings/models/video/video-streaming-playlist.ts deleted file mode 100644 index 3f54aa560..000000000 --- a/server/typings/models/video/video-streaming-playlist.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { VideoStreamingPlaylistModel } from '../../../models/video/video-streaming-playlist' -import { PickWith, PickWithOpt } from '../../utils' -import { MVideoRedundancyFileUrl, MVideoRedundancy } from './video-redundancy' -import { MVideo } from './video' -import { MVideoFile } from './video-file' - -type Use = PickWith - -// ############################################################################ - -export type MStreamingPlaylist = Omit - -export type MStreamingPlaylistFiles = - MStreamingPlaylist & - Use<'VideoFiles', MVideoFile[]> - -export type MStreamingPlaylistVideo = - MStreamingPlaylist & - Use<'Video', MVideo> - -export type MStreamingPlaylistFilesVideo = - MStreamingPlaylist & - Use<'VideoFiles', MVideoFile[]> & - Use<'Video', MVideo> - -export type MStreamingPlaylistRedundanciesAll = - MStreamingPlaylist & - Use<'VideoFiles', MVideoFile[]> & - Use<'RedundancyVideos', MVideoRedundancy[]> - -export type MStreamingPlaylistRedundancies = - MStreamingPlaylist & - Use<'VideoFiles', MVideoFile[]> & - Use<'RedundancyVideos', MVideoRedundancyFileUrl[]> - -export type MStreamingPlaylistRedundanciesOpt = - MStreamingPlaylist & - Use<'VideoFiles', MVideoFile[]> & - PickWithOpt - -export function isStreamingPlaylist (value: MVideo | MStreamingPlaylistVideo): value is MStreamingPlaylistVideo { - return !!(value as MStreamingPlaylist).playlistUrl -} diff --git a/server/typings/models/video/video.ts b/server/typings/models/video/video.ts deleted file mode 100644 index 022a9566d..000000000 --- a/server/typings/models/video/video.ts +++ /dev/null @@ -1,211 +0,0 @@ -import { VideoModel } from '../../../models/video/video' -import { PickWith, PickWithOpt } from '../../utils' -import { - MChannelAccountDefault, - MChannelAccountLight, - MChannelAccountSummaryFormattable, - MChannelActor, - MChannelFormattable, - MChannelUserId -} from './video-channels' -import { MTag } from './tag' -import { MVideoCaptionLanguage, MVideoCaptionLanguageUrl } from './video-caption' -import { - MStreamingPlaylistFiles, - MStreamingPlaylistRedundancies, - MStreamingPlaylistRedundanciesAll, - MStreamingPlaylistRedundanciesOpt -} from './video-streaming-playlist' -import { MVideoFile, MVideoFileRedundanciesAll, MVideoFileRedundanciesOpt } from './video-file' -import { MThumbnail } from './thumbnail' -import { MVideoBlacklist, MVideoBlacklistLight, MVideoBlacklistUnfederated } from './video-blacklist' -import { MScheduleVideoUpdate } from './schedule-video-update' -import { MUserVideoHistoryTime } from '../user/user-video-history' - -type Use = PickWith - -// ############################################################################ - -export type MVideo = - Omit - -// ############################################################################ - -export type MVideoId = Pick -export type MVideoUrl = Pick -export type MVideoUUID = Pick - -export type MVideoImmutable = Pick -export type MVideoIdUrl = MVideoId & MVideoUrl -export type MVideoFeed = Pick - -// ############################################################################ - -// Video raw associations: schedules, video files, tags, thumbnails, captions, streaming playlists - -// "With" to not confuse with the VideoFile model -export type MVideoWithFile = - MVideo & - Use<'VideoFiles', MVideoFile[]> & - Use<'VideoStreamingPlaylists', MStreamingPlaylistFiles[]> - -export type MVideoThumbnail = - MVideo & - Use<'Thumbnails', MThumbnail[]> - -export type MVideoIdThumbnail = - MVideoId & - Use<'Thumbnails', MThumbnail[]> - -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[]> - -export type MVideoWithSchedule = - MVideo & - PickWithOpt - -export type MVideoWithCaptions = - MVideo & - Use<'VideoCaptions', MVideoCaptionLanguage[]> - -export type MVideoWithStreamingPlaylist = - MVideo & - Use<'VideoStreamingPlaylists', MStreamingPlaylistFiles[]> - -// ############################################################################ - -// Associations with not all their attributes - -export type MVideoUserHistory = - MVideo & - Use<'UserVideoHistories', MUserVideoHistoryTime[]> - -export type MVideoWithBlacklistLight = - MVideo & - Use<'VideoBlacklist', MVideoBlacklistLight> - -export type MVideoAccountLight = - MVideo & - Use<'VideoChannel', MChannelAccountLight> - -export type MVideoWithRights = - MVideo & - Use<'VideoBlacklist', MVideoBlacklistLight> & - Use<'Thumbnails', MThumbnail[]> & - Use<'VideoChannel', MChannelUserId> - -// ############################################################################ - -// All files with some additional associations - -export type MVideoWithAllFiles = - MVideo & - Use<'VideoFiles', MVideoFile[]> & - Use<'Thumbnails', MThumbnail[]> & - Use<'VideoStreamingPlaylists', MStreamingPlaylistFiles[]> - -export type MVideoAccountLightBlacklistAllFiles = - MVideo & - Use<'VideoFiles', MVideoFile[]> & - Use<'Thumbnails', MThumbnail[]> & - Use<'VideoStreamingPlaylists', MStreamingPlaylistFiles[]> & - Use<'VideoChannel', MChannelAccountLight> & - Use<'VideoBlacklist', MVideoBlacklistLight> - -// ############################################################################ - -// With account - -export type MVideoAccountDefault = - MVideo & - Use<'VideoChannel', MChannelAccountDefault> - -export type MVideoThumbnailAccountDefault = - MVideo & - Use<'Thumbnails', MThumbnail[]> & - Use<'VideoChannel', MChannelAccountDefault> - -export type MVideoWithChannelActor = - MVideo & - 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', MStreamingPlaylistFiles[]> - -// ############################################################################ - -// API - -export type MVideoAP = - MVideo & - Use<'Tags', MTag[]> & - Use<'VideoChannel', MChannelAccountLight> & - Use<'VideoStreamingPlaylists', MStreamingPlaylistFiles[]> & - Use<'VideoCaptions', MVideoCaptionLanguageUrl[]> & - Use<'VideoBlacklist', MVideoBlacklistUnfederated> & - Use<'VideoFiles', MVideoFileRedundanciesOpt[]> & - Use<'Thumbnails', MThumbnail[]> - -export type MVideoAPWithoutCaption = Omit - -export type MVideoDetails = - MVideo & - 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[]> - -export type MVideoForRedundancyAPI = - MVideo & - Use<'VideoFiles', MVideoFileRedundanciesAll[]> & - Use<'VideoStreamingPlaylists', MStreamingPlaylistRedundanciesAll[]> - -// ############################################################################ - -// Format for API or AP object - -export type MVideoFormattable = - MVideo & - PickWithOpt & - Use<'VideoChannel', MChannelAccountSummaryFormattable> & - PickWithOpt> & - PickWithOpt> - -export type MVideoFormattableDetails = - MVideoFormattable & - Use<'VideoChannel', MChannelFormattable> & - Use<'Tags', MTag[]> & - Use<'VideoStreamingPlaylists', MStreamingPlaylistRedundanciesOpt[]> & - Use<'VideoFiles', MVideoFileRedundanciesOpt[]> -- cgit v1.2.3