X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftypings%2Fmodels%2Fvideo%2Fvideo-channels.ts;h=292d0ac95335184341a8ae7a69180b9e61f9250d;hb=b5fecbf44192144d1ca27c23a0b53922de288c10;hp=e10bd68426f8dfd2ce07fa4196efb6285c07dd32;hpb=453e83ea5d81d203ba34bc43cd5c2c750ba40568;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/typings/models/video/video-channels.ts b/server/typings/models/video/video-channels.ts index e10bd6842..292d0ac95 100644 --- a/server/typings/models/video/video-channels.ts +++ b/server/typings/models/video/video-channels.ts @@ -1,70 +1,126 @@ -import { FunctionProperties, PickWith } from '../../utils' +import { FunctionProperties, PickWith, PickWithOpt } from '../../utils' import { VideoChannelModel } from '../../../models/video/video-channel' import { MAccountActor, MAccountAPI, - MAccountBlocks, MAccountDefault, + MAccountFormattable, MAccountLight, + MAccountSummaryBlocks, + MAccountSummaryFormattable, + MAccountUrl, MAccountUserId, MActor, MActorAccountChannelId, + MActorAP, MActorAPI, MActorDefault, - MActorDefaultLight, MActorLight, - MActorSummary + MActorDefaultLight, + MActorFormattable, + MActorLight, + MActorSummary, + MActorSummaryFormattable, MActorUrl } from '../account' import { MVideo } from './video' -export type MChannelId = FunctionProperties -export type MChannelIdActor = MChannelId & - PickWith +type Use = PickWith + +// ############################################################################ export type MChannel = Omit +// ############################################################################ + +export type MChannelId = Pick + +// ############################################################################ + +export type MChannelIdActor = MChannelId & + Use<'Actor', MActorAccountChannelId> + export type MChannelUserId = Pick & - PickWith + Use<'Account', MAccountUserId> + +export type MChannelActor = MChannel & + Use<'Actor', MActor> + +export type MChannelUrl = Use<'Actor', MActorUrl> // Default scope export type MChannelDefault = MChannel & - PickWith + Use<'Actor', MActorDefault> + +// ############################################################################ + +// Not all association attributes export type MChannelLight = MChannel & - PickWith + Use<'Actor', MActorDefaultLight> + +export type MChannelActorLight = MChannel & + Use<'Actor', MActorLight> export type MChannelAccountLight = MChannel & - PickWith & - PickWith + Use<'Actor', MActorDefaultLight> & + Use<'Account', MAccountLight> + +// ############################################################################ -export type MChannelSummary = Pick & - PickWith +// Account associations + +export type MChannelAccountActor = MChannel & + Use<'Account', MAccountActor> + +export type MChannelAccountDefault = MChannel & + Use<'Actor', MActorDefault> & + Use<'Account', MAccountDefault> + +export type MChannelActorAccountActor = MChannel & + Use<'Account', MAccountActor> & + Use<'Actor', MActor> + +// ############################################################################ + +// Videos associations +export type MChannelVideos = MChannel & + Use<'Videos', MVideo[]> + +export type MChannelActorAccountDefaultVideos = MChannel & + Use<'Actor', MActorDefault> & + Use<'Account', MAccountDefault> & + Use<'Videos', MVideo[]> + +// ############################################################################ + +// For API + +export type MChannelSummary = FunctionProperties & + Pick & + Use<'Actor', MActorSummary> export type MChannelSummaryAccount = MChannelSummary & - PickWith + Use<'Account', MAccountSummaryBlocks> export type MChannelAPI = MChannel & - PickWith & - PickWith + Use<'Actor', MActorAPI> & + Use<'Account', MAccountAPI> -export type MChannelAccountActor = MChannel & - PickWith -export type MChannelAccountDefault = MChannelActor & - PickWith +// ############################################################################ -export type MChannelVideos = MChannel & - PickWith +// Format for API or AP object -export type MChannelActor = MChannel & - PickWith -export type MChannelActorLight = MChannel & - PickWith -export type MChannelActorDefault = MChannel & - PickWith +export type MChannelSummaryFormattable = FunctionProperties & + Pick & + Use<'Actor', MActorSummaryFormattable> -export type MChannelActorAccountActor = MChannelAccountActor & MChannelActor +export type MChannelAccountSummaryFormattable = MChannelSummaryFormattable & + Use<'Account', MAccountSummaryFormattable> -export type MChannelActorAccountDefault = MChannel & - PickWith & - PickWith +export type MChannelFormattable = FunctionProperties & + Pick & + Use<'Actor', MActorFormattable> & + PickWithOpt -export type MChannelActorAccountDefaultVideos = MChannelActorAccountDefault & MChannelVideos +export type MChannelAP = Pick & + Use<'Actor', MActorAP> & + Use<'Account', MAccountUrl>