PeerTube/server/types/models/video/video-rate.ts

28 lines
951 B
TypeScript
Raw Normal View History

2019-08-15 11:53:26 +02:00
import { AccountVideoRateModel } from '@server/models/account/account-video-rate'
2020-06-23 14:10:17 +02:00
import { PickWith } from '@shared/core-utils'
import { MAccountAudience, MAccountUrl } from '../account/account'
import { MVideo, MVideoFormattable } from './video'
2019-08-15 11:53:26 +02:00
2019-08-20 13:52:49 +02:00
type Use<K extends keyof AccountVideoRateModel, M> = PickWith<AccountVideoRateModel, K, M>
// ############################################################################
2019-08-15 11:53:26 +02:00
export type MAccountVideoRate = Omit<AccountVideoRateModel, 'Video' | 'Account'>
2020-01-31 16:56:52 +01:00
export type MAccountVideoRateAccountUrl =
MAccountVideoRate &
2019-08-20 13:52:49 +02:00
Use<'Account', MAccountUrl>
2019-08-15 11:53:26 +02:00
2020-01-31 16:56:52 +01:00
export type MAccountVideoRateAccountVideo =
MAccountVideoRate &
2019-08-20 13:52:49 +02:00
Use<'Account', MAccountAudience> &
Use<'Video', MVideo>
2019-08-20 19:05:31 +02:00
// ############################################################################
// Format for API or AP object
2020-01-31 16:56:52 +01:00
export type MAccountVideoRateFormattable =
Pick<MAccountVideoRate, 'type'> &
2019-08-20 19:05:31 +02:00
Use<'Video', MVideoFormattable>