1 import { FunctionProperties, PickWith, PickWithOpt } from '@shared/core-utils'
2 import { VideoChannelModel } from '../../../models/video/video-channel'
10 MAccountSummaryFormattable,
14 MActorAccountChannelId,
24 MActorSummaryFormattable,
27 import { MVideo } from './video'
29 type Use<K extends keyof VideoChannelModel, M> = PickWith<VideoChannelModel, K, M>
31 // ############################################################################
33 export type MChannel = Omit<VideoChannelModel, 'Actor' | 'Account' | 'Videos' | 'VideoPlaylists'>
35 // ############################################################################
37 export type MChannelId = Pick<MChannel, 'id'>
39 // ############################################################################
41 export type MChannelIdActor =
43 Use<'Actor', MActorAccountChannelId>
45 export type MChannelUserId =
46 Pick<MChannel, 'accountId'> &
47 Use<'Account', MAccountUserId>
49 export type MChannelActor =
53 export type MChannelUrl = Use<'Actor', MActorUrl>
56 export type MChannelDefault =
58 Use<'Actor', MActorDefault>
60 export type MChannelBannerDefault =
62 Use<'Actor', MActorDefaultBanner>
64 // ############################################################################
66 // Not all association attributes
68 export type MChannelActorLight =
70 Use<'Actor', MActorLight>
72 export type MChannelAccountLight =
74 Use<'Actor', MActorDefaultLight> &
75 Use<'Account', MAccountLight>
77 export type MChannelHost =
79 Use<'Actor', MActorHost>
81 // ############################################################################
83 // Account associations
85 export type MChannelAccountActor =
87 Use<'Account', MAccountActor>
89 export type MChannelBannerAccountDefault =
91 Use<'Actor', MActorDefaultBanner> &
92 Use<'Account', MAccountDefault>
94 export type MChannelAccountDefault =
96 Use<'Actor', MActorDefault> &
97 Use<'Account', MAccountDefault>
99 // ############################################################################
101 // Videos associations
102 export type MChannelVideos =
104 Use<'Videos', MVideo[]>
106 // ############################################################################
110 export type MChannelSummary =
111 FunctionProperties<MChannel> &
112 Pick<MChannel, 'id' | 'name' | 'description' | 'actorId'> &
113 Use<'Actor', MActorSummary>
115 export type MChannelSummaryAccount =
117 Use<'Account', MAccountSummaryBlocks>
119 export type MChannelAPI =
121 Use<'Actor', MActorAPI> &
122 Use<'Account', MAccountAPI>
124 // ############################################################################
126 // Format for API or AP object
128 export type MChannelSummaryFormattable =
129 FunctionProperties<MChannel> &
130 Pick<MChannel, 'id' | 'name'> &
131 Use<'Actor', MActorSummaryFormattable>
133 export type MChannelAccountSummaryFormattable =
134 MChannelSummaryFormattable &
135 Use<'Account', MAccountSummaryFormattable>
137 export type MChannelFormattable =
138 FunctionProperties<MChannel> &
139 Pick<MChannel, 'id' | 'name' | 'description' | 'createdAt' | 'updatedAt' | 'support'> &
140 Use<'Actor', MActorFormattable> &
141 PickWithOpt<VideoChannelModel, 'Account', MAccountFormattable>
143 export type MChannelAP =
144 Pick<MChannel, 'name' | 'description' | 'support'> &
145 Use<'Actor', MActorAPChannel> &
146 Use<'Account', MAccountUrl>