PeerTube/server/typings/models/video/video-import.ts

33 lines
1.2 KiB
TypeScript
Raw Normal View History

2019-08-15 11:53:26 +02:00
import { VideoImportModel } from '@server/models/video/video-import'
2019-08-20 19:05:31 +02:00
import { PickWith, PickWithOpt } from '@server/typings/utils'
import { MVideo, MVideoAccountLight, MVideoFormattable, MVideoTag, MVideoThumbnail, MVideoWithFile } from './video'
import { MUser } from '../user/user'
2019-08-15 11:53:26 +02:00
2019-08-20 13:52:49 +02:00
type Use<K extends keyof VideoImportModel, M> = PickWith<VideoImportModel, K, M>
2019-08-15 11:53:26 +02:00
2019-08-20 13:52:49 +02:00
// ############################################################################
2019-08-15 11:53:26 +02:00
2019-08-20 13:52:49 +02:00
export type MVideoImport = Omit<VideoImportModel, 'User' | 'Video'>
2019-08-15 11:53:26 +02:00
export type MVideoImportVideo = MVideoImport &
2019-08-20 13:52:49 +02:00
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>
2019-08-20 19:05:31 +02:00
// ############################################################################
// Format for API or AP object
export type MVideoImportFormattable = MVideoImport &
PickWithOpt<VideoImportModel, 'Video', MVideoFormattable & MVideoTag>