PeerTube/server/typings/models/video/video-change-ownership.ts

24 lines
1.1 KiB
TypeScript
Raw Normal View History

2019-08-15 11:53:26 +02:00
import { VideoChangeOwnershipModel } from '@server/models/video/video-change-ownership'
import { PickWith } from '@server/typings/utils'
2019-08-20 19:05:31 +02:00
import { MAccountDefault, MAccountFormattable, MVideo, MVideoWithFileThumbnail } from '@server/typings/models'
2019-08-15 11:53:26 +02:00
2019-08-20 13:52:49 +02:00
type Use<K extends keyof VideoChangeOwnershipModel, M> = PickWith<VideoChangeOwnershipModel, K, M>
// ############################################################################
2019-08-15 11:53:26 +02:00
export type MVideoChangeOwnership = Omit<VideoChangeOwnershipModel, 'Initiator' | 'NextOwner' | 'Video'>
export type MVideoChangeOwnershipFull = MVideoChangeOwnership &
2019-08-20 13:52:49 +02:00
Use<'Initiator', MAccountDefault> &
Use<'NextOwner', MAccountDefault> &
Use<'Video', MVideoWithFileThumbnail>
2019-08-20 19:05:31 +02:00
// ############################################################################
// Format for API or AP object
export type MVideoChangeOwnershipFormattable = Pick<MVideoChangeOwnership, 'id' | 'status' | 'createdAt'> &
Use<'Initiator', MAccountFormattable> &
Use<'NextOwner', MAccountFormattable> &
Use<'Video', Pick<MVideo, 'id' | 'uuid' | 'url' | 'name'>>