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

24 lines
1.1 KiB
TypeScript
Raw Normal View History

2019-08-15 04:53:26 -05:00
import { VideoChangeOwnershipModel } from '@server/models/video/video-change-ownership'
import { PickWith } from '@server/typings/utils'
2019-08-20 12:05:31 -05:00
import { MAccountDefault, MAccountFormattable, MVideo, MVideoWithFileThumbnail } from '@server/typings/models'
2019-08-15 04:53:26 -05:00
2019-08-20 06:52:49 -05:00
type Use<K extends keyof VideoChangeOwnershipModel, M> = PickWith<VideoChangeOwnershipModel, K, M>
// ############################################################################
2019-08-15 04:53:26 -05:00
export type MVideoChangeOwnership = Omit<VideoChangeOwnershipModel, 'Initiator' | 'NextOwner' | 'Video'>
export type MVideoChangeOwnershipFull = MVideoChangeOwnership &
2019-08-20 06:52:49 -05:00
Use<'Initiator', MAccountDefault> &
Use<'NextOwner', MAccountDefault> &
Use<'Video', MVideoWithFileThumbnail>
2019-08-20 12:05:31 -05: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'>>