]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/typings/models/video/video-channels.ts
Type toActivityPubObject functions
[github/Chocobozzz/PeerTube.git] / server / typings / models / video / video-channels.ts
CommitLineData
1ca9f7c3 1import { FunctionProperties, PickWith, PickWithOpt } from '../../utils'
453e83ea
C
2import { VideoChannelModel } from '../../../models/video/video-channel'
3import {
4 MAccountActor,
5 MAccountAPI,
453e83ea 6 MAccountDefault,
1ca9f7c3 7 MAccountFormattable,
453e83ea 8 MAccountLight,
0283eaac 9 MAccountSummaryBlocks,
1ca9f7c3 10 MAccountSummaryFormattable,
b5fecbf4 11 MAccountUrl,
453e83ea
C
12 MAccountUserId,
13 MActor,
14 MActorAccountChannelId,
b5fecbf4 15 MActorAP,
453e83ea
C
16 MActorAPI,
17 MActorDefault,
0283eaac 18 MActorDefaultLight,
1ca9f7c3 19 MActorFormattable,
0283eaac 20 MActorLight,
1ca9f7c3 21 MActorSummary,
b5fecbf4 22 MActorSummaryFormattable, MActorUrl
453e83ea
C
23} from '../account'
24import { MVideo } from './video'
25
0283eaac
C
26type Use<K extends keyof VideoChannelModel, M> = PickWith<VideoChannelModel, K, M>
27
28// ############################################################################
453e83ea
C
29
30export type MChannel = Omit<VideoChannelModel, 'Actor' | 'Account' | 'Videos' | 'VideoPlaylists'>
31
0283eaac
C
32// ############################################################################
33
34export type MChannelId = Pick<MChannel, 'id'>
35
36// ############################################################################
37
38export type MChannelIdActor = MChannelId &
39 Use<'Actor', MActorAccountChannelId>
40
453e83ea 41export type MChannelUserId = Pick<MChannel, 'accountId'> &
0283eaac
C
42 Use<'Account', MAccountUserId>
43
44export type MChannelActor = MChannel &
45 Use<'Actor', MActor>
453e83ea 46
b5fecbf4
C
47export type MChannelUrl = Use<'Actor', MActorUrl>
48
453e83ea
C
49// Default scope
50export type MChannelDefault = MChannel &
0283eaac
C
51 Use<'Actor', MActorDefault>
52
53// ############################################################################
54
55// Not all association attributes
453e83ea
C
56
57export type MChannelLight = MChannel &
0283eaac 58 Use<'Actor', MActorDefaultLight>
453e83ea 59
0283eaac
C
60export type MChannelActorLight = MChannel &
61 Use<'Actor', MActorLight>
453e83ea 62
0283eaac
C
63export type MChannelAccountLight = MChannel &
64 Use<'Actor', MActorDefaultLight> &
65 Use<'Account', MAccountLight>
453e83ea 66
0283eaac 67// ############################################################################
453e83ea 68
0283eaac 69// Account associations
453e83ea
C
70
71export type MChannelAccountActor = MChannel &
0283eaac
C
72 Use<'Account', MAccountActor>
73
74export type MChannelAccountDefault = MChannel &
75 Use<'Actor', MActorDefault> &
76 Use<'Account', MAccountDefault>
453e83ea 77
0283eaac
C
78export type MChannelActorAccountActor = MChannel &
79 Use<'Account', MAccountActor> &
80 Use<'Actor', MActor>
81
82// ############################################################################
83
84// Videos associations
453e83ea 85export type MChannelVideos = MChannel &
0283eaac 86 Use<'Videos', MVideo[]>
453e83ea 87
0283eaac
C
88export type MChannelActorAccountDefaultVideos = MChannel &
89 Use<'Actor', MActorDefault> &
90 Use<'Account', MAccountDefault> &
91 Use<'Videos', MVideo[]>
92
93// ############################################################################
94
95// For API
453e83ea 96
1ca9f7c3
C
97export type MChannelSummary = FunctionProperties<MChannel> &
98 Pick<MChannel, 'id' | 'name' | 'description' | 'actorId'> &
0283eaac 99 Use<'Actor', MActorSummary>
453e83ea 100
0283eaac
C
101export type MChannelSummaryAccount = MChannelSummary &
102 Use<'Account', MAccountSummaryBlocks>
453e83ea 103
0283eaac
C
104export type MChannelAPI = MChannel &
105 Use<'Actor', MActorAPI> &
106 Use<'Account', MAccountAPI>
1ca9f7c3
C
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>
b5fecbf4
C
123
124export type MChannelAP = Pick<MChannel, 'name' | 'description' | 'support'> &
125 Use<'Actor', MActorAP> &
126 Use<'Account', MAccountUrl>