aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/typings/models/video/video-channels.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/typings/models/video/video-channels.ts')
-rw-r--r--server/typings/models/video/video-channels.ts126
1 files changed, 126 insertions, 0 deletions
diff --git a/server/typings/models/video/video-channels.ts b/server/typings/models/video/video-channels.ts
new file mode 100644
index 000000000..292d0ac95
--- /dev/null
+++ b/server/typings/models/video/video-channels.ts
@@ -0,0 +1,126 @@
1import { FunctionProperties, PickWith, PickWithOpt } from '../../utils'
2import { VideoChannelModel } from '../../../models/video/video-channel'
3import {
4 MAccountActor,
5 MAccountAPI,
6 MAccountDefault,
7 MAccountFormattable,
8 MAccountLight,
9 MAccountSummaryBlocks,
10 MAccountSummaryFormattable,
11 MAccountUrl,
12 MAccountUserId,
13 MActor,
14 MActorAccountChannelId,
15 MActorAP,
16 MActorAPI,
17 MActorDefault,
18 MActorDefaultLight,
19 MActorFormattable,
20 MActorLight,
21 MActorSummary,
22 MActorSummaryFormattable, MActorUrl
23} from '../account'
24import { MVideo } from './video'
25
26type Use<K extends keyof VideoChannelModel, M> = PickWith<VideoChannelModel, K, M>
27
28// ############################################################################
29
30export type MChannel = Omit<VideoChannelModel, 'Actor' | 'Account' | 'Videos' | 'VideoPlaylists'>
31
32// ############################################################################
33
34export type MChannelId = Pick<MChannel, 'id'>
35
36// ############################################################################
37
38export type MChannelIdActor = MChannelId &
39 Use<'Actor', MActorAccountChannelId>
40
41export type MChannelUserId = Pick<MChannel, 'accountId'> &
42 Use<'Account', MAccountUserId>
43
44export type MChannelActor = MChannel &
45 Use<'Actor', MActor>
46
47export type MChannelUrl = Use<'Actor', MActorUrl>
48
49// Default scope
50export type MChannelDefault = MChannel &
51 Use<'Actor', MActorDefault>
52
53// ############################################################################
54
55// Not all association attributes
56
57export type MChannelLight = MChannel &
58 Use<'Actor', MActorDefaultLight>
59
60export type MChannelActorLight = MChannel &
61 Use<'Actor', MActorLight>
62
63export type MChannelAccountLight = MChannel &
64 Use<'Actor', MActorDefaultLight> &
65 Use<'Account', MAccountLight>
66
67// ############################################################################
68
69// Account associations
70
71export type MChannelAccountActor = MChannel &
72 Use<'Account', MAccountActor>
73
74export type MChannelAccountDefault = MChannel &
75 Use<'Actor', MActorDefault> &
76 Use<'Account', MAccountDefault>
77
78export type MChannelActorAccountActor = MChannel &
79 Use<'Account', MAccountActor> &
80 Use<'Actor', MActor>
81
82// ############################################################################
83
84// Videos associations
85export type MChannelVideos = MChannel &
86 Use<'Videos', MVideo[]>
87
88export type MChannelActorAccountDefaultVideos = MChannel &
89 Use<'Actor', MActorDefault> &
90 Use<'Account', MAccountDefault> &
91 Use<'Videos', MVideo[]>
92
93// ############################################################################
94
95// For API
96
97export type MChannelSummary = FunctionProperties<MChannel> &
98 Pick<MChannel, 'id' | 'name' | 'description' | 'actorId'> &
99 Use<'Actor', MActorSummary>
100
101export type MChannelSummaryAccount = MChannelSummary &
102 Use<'Account', MAccountSummaryBlocks>
103
104export type MChannelAPI = MChannel &
105 Use<'Actor', MActorAPI> &
106 Use<'Account', MAccountAPI>
107
108// ############################################################################
109
110// Format for API or AP object
111
112export type MChannelSummaryFormattable = FunctionProperties<MChannel> &
113 Pick<MChannel, 'id' | 'name'> &
114 Use<'Actor', MActorSummaryFormattable>
115
116export type MChannelAccountSummaryFormattable = MChannelSummaryFormattable &
117 Use<'Account', MAccountSummaryFormattable>
118
119export type MChannelFormattable = FunctionProperties<MChannel> &
120 Pick<MChannel, 'id' | 'name' | 'description' | 'createdAt' | 'updatedAt' | 'support'> &
121 Use<'Actor', MActorFormattable> &
122 PickWithOpt<VideoChannelModel, 'Account', MAccountFormattable>
123
124export type MChannelAP = Pick<MChannel, 'name' | 'description' | 'support'> &
125 Use<'Actor', MActorAP> &
126 Use<'Account', MAccountUrl>