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