Add ability to disable webtorrent
[oweals/peertube.git] / server / typings / models / video / video-rate.ts
index 6eefe636212dfd3ba26e5a5a8fb25c23ceeefc0f..f6bb527fc8079eee41c99bb981a84c6955c360cc 100644 (file)
@@ -1,12 +1,24 @@
 import { AccountVideoRateModel } from '@server/models/account/account-video-rate'
 import { PickWith } from '@server/typings/utils'
-import { MAccountAudience, MAccountUrl, MVideo } from '..'
+import { MAccountAudience, MAccountUrl } from '../account/account'
+import { MVideo, MVideoFormattable } from './video'
+
+type Use<K extends keyof AccountVideoRateModel, M> = PickWith<AccountVideoRateModel, K, M>
+
+// ############################################################################
 
 export type MAccountVideoRate = Omit<AccountVideoRateModel, 'Video' | 'Account'>
 
 export type MAccountVideoRateAccountUrl = MAccountVideoRate &
-  PickWith<AccountVideoRateModel, 'Account', MAccountUrl>
+  Use<'Account', MAccountUrl>
 
 export type MAccountVideoRateAccountVideo = MAccountVideoRate &
-  PickWith<AccountVideoRateModel, 'Account', MAccountAudience> &
-  PickWith<AccountVideoRateModel, 'Video', MVideo>
+  Use<'Account', MAccountAudience> &
+  Use<'Video', MVideo>
+
+// ############################################################################
+
+// Format for API or AP object
+
+export type MAccountVideoRateFormattable = Pick<MAccountVideoRate, 'type'> &
+  Use<'Video', MVideoFormattable>