]>
Commit | Line | Data |
---|---|---|
0283eaac | 1 | import { PickWith } from '../../utils' |
453e83ea C |
2 | import { VideoChannelModel } from '../../../models/video/video-channel' |
3 | import { | |
4 | MAccountActor, | |
5 | MAccountAPI, | |
453e83ea C |
6 | MAccountDefault, |
7 | MAccountLight, | |
0283eaac | 8 | MAccountSummaryBlocks, |
453e83ea C |
9 | MAccountUserId, |
10 | MActor, | |
11 | MActorAccountChannelId, | |
12 | MActorAPI, | |
13 | MActorDefault, | |
0283eaac C |
14 | MActorDefaultLight, |
15 | MActorLight, | |
453e83ea C |
16 | MActorSummary |
17 | } from '../account' | |
18 | import { MVideo } from './video' | |
19 | ||
0283eaac C |
20 | type Use<K extends keyof VideoChannelModel, M> = PickWith<VideoChannelModel, K, M> |
21 | ||
22 | // ############################################################################ | |
453e83ea C |
23 | |
24 | export type MChannel = Omit<VideoChannelModel, 'Actor' | 'Account' | 'Videos' | 'VideoPlaylists'> | |
25 | ||
0283eaac C |
26 | // ############################################################################ |
27 | ||
28 | export type MChannelId = Pick<MChannel, 'id'> | |
29 | ||
30 | // ############################################################################ | |
31 | ||
32 | export type MChannelIdActor = MChannelId & | |
33 | Use<'Actor', MActorAccountChannelId> | |
34 | ||
453e83ea | 35 | export type MChannelUserId = Pick<MChannel, 'accountId'> & |
0283eaac C |
36 | Use<'Account', MAccountUserId> |
37 | ||
38 | export type MChannelActor = MChannel & | |
39 | Use<'Actor', MActor> | |
453e83ea C |
40 | |
41 | // Default scope | |
42 | export type MChannelDefault = MChannel & | |
0283eaac C |
43 | Use<'Actor', MActorDefault> |
44 | ||
45 | // ############################################################################ | |
46 | ||
47 | // Not all association attributes | |
453e83ea C |
48 | |
49 | export type MChannelLight = MChannel & | |
0283eaac | 50 | Use<'Actor', MActorDefaultLight> |
453e83ea | 51 | |
0283eaac C |
52 | export type MChannelActorLight = MChannel & |
53 | Use<'Actor', MActorLight> | |
453e83ea | 54 | |
0283eaac C |
55 | export type MChannelAccountLight = MChannel & |
56 | Use<'Actor', MActorDefaultLight> & | |
57 | Use<'Account', MAccountLight> | |
453e83ea | 58 | |
0283eaac | 59 | // ############################################################################ |
453e83ea | 60 | |
0283eaac | 61 | // Account associations |
453e83ea C |
62 | |
63 | export type MChannelAccountActor = MChannel & | |
0283eaac C |
64 | Use<'Account', MAccountActor> |
65 | ||
66 | export type MChannelAccountDefault = MChannel & | |
67 | Use<'Actor', MActorDefault> & | |
68 | Use<'Account', MAccountDefault> | |
453e83ea | 69 | |
0283eaac C |
70 | export type MChannelActorAccountActor = MChannel & |
71 | Use<'Account', MAccountActor> & | |
72 | Use<'Actor', MActor> | |
73 | ||
74 | // ############################################################################ | |
75 | ||
76 | // Videos associations | |
453e83ea | 77 | export type MChannelVideos = MChannel & |
0283eaac | 78 | Use<'Videos', MVideo[]> |
453e83ea | 79 | |
0283eaac C |
80 | export type MChannelActorAccountDefaultVideos = MChannel & |
81 | Use<'Actor', MActorDefault> & | |
82 | Use<'Account', MAccountDefault> & | |
83 | Use<'Videos', MVideo[]> | |
84 | ||
85 | // ############################################################################ | |
86 | ||
87 | // For API | |
453e83ea | 88 | |
0283eaac C |
89 | export type MChannelSummary = Pick<MChannel, 'id' | 'name' | 'description' | 'actorId'> & |
90 | Use<'Actor', MActorSummary> | |
453e83ea | 91 | |
0283eaac C |
92 | export type MChannelSummaryAccount = MChannelSummary & |
93 | Use<'Account', MAccountSummaryBlocks> | |
453e83ea | 94 | |
0283eaac C |
95 | export type MChannelAPI = MChannel & |
96 | Use<'Actor', MActorAPI> & | |
97 | Use<'Account', MAccountAPI> |