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

27 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'
import { MAccountDefault, MAccountFormattable } from '../account/account'
import { MVideo, MVideoWithAllFiles } from './video'
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'>
2020-01-31 16:56:52 +01:00
export type MVideoChangeOwnershipFull =
MVideoChangeOwnership &
2019-08-20 13:52:49 +02:00
Use<'Initiator', MAccountDefault> &
Use<'NextOwner', MAccountDefault> &
Use<'Video', MVideoWithAllFiles>
2019-08-20 19:05:31 +02:00
// ############################################################################
// Format for API or AP object
2020-01-31 16:56:52 +01:00
export type MVideoChangeOwnershipFormattable =
Pick<MVideoChangeOwnership, 'id' | 'status' | 'createdAt'> &
2019-08-20 19:05:31 +02:00
Use<'Initiator', MAccountFormattable> &
Use<'NextOwner', MAccountFormattable> &
Use<'Video', Pick<MVideo, 'id' | 'uuid' | 'url' | 'name'>>