]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/typings/models/video/video-channels.ts
Cleanup model types
[github/Chocobozzz/PeerTube.git] / server / typings / models / video / video-channels.ts
CommitLineData
0283eaac 1import { PickWith } from '../../utils'
453e83ea
C
2import { VideoChannelModel } from '../../../models/video/video-channel'
3import {
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'
18import { MVideo } from './video'
19
0283eaac
C
20type Use<K extends keyof VideoChannelModel, M> = PickWith<VideoChannelModel, K, M>
21
22// ############################################################################
453e83ea
C
23
24export type MChannel = Omit<VideoChannelModel, 'Actor' | 'Account' | 'Videos' | 'VideoPlaylists'>
25
0283eaac
C
26// ############################################################################
27
28export type MChannelId = Pick<MChannel, 'id'>
29
30// ############################################################################
31
32export type MChannelIdActor = MChannelId &
33 Use<'Actor', MActorAccountChannelId>
34
453e83ea 35export type MChannelUserId = Pick<MChannel, 'accountId'> &
0283eaac
C
36 Use<'Account', MAccountUserId>
37
38export type MChannelActor = MChannel &
39 Use<'Actor', MActor>
453e83ea
C
40
41// Default scope
42export type MChannelDefault = MChannel &
0283eaac
C
43 Use<'Actor', MActorDefault>
44
45// ############################################################################
46
47// Not all association attributes
453e83ea
C
48
49export type MChannelLight = MChannel &
0283eaac 50 Use<'Actor', MActorDefaultLight>
453e83ea 51
0283eaac
C
52export type MChannelActorLight = MChannel &
53 Use<'Actor', MActorLight>
453e83ea 54
0283eaac
C
55export type MChannelAccountLight = MChannel &
56 Use<'Actor', MActorDefaultLight> &
57 Use<'Account', MAccountLight>
453e83ea 58
0283eaac 59// ############################################################################
453e83ea 60
0283eaac 61// Account associations
453e83ea
C
62
63export type MChannelAccountActor = MChannel &
0283eaac
C
64 Use<'Account', MAccountActor>
65
66export type MChannelAccountDefault = MChannel &
67 Use<'Actor', MActorDefault> &
68 Use<'Account', MAccountDefault>
453e83ea 69
0283eaac
C
70export type MChannelActorAccountActor = MChannel &
71 Use<'Account', MAccountActor> &
72 Use<'Actor', MActor>
73
74// ############################################################################
75
76// Videos associations
453e83ea 77export type MChannelVideos = MChannel &
0283eaac 78 Use<'Videos', MVideo[]>
453e83ea 79
0283eaac
C
80export 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
89export type MChannelSummary = Pick<MChannel, 'id' | 'name' | 'description' | 'actorId'> &
90 Use<'Actor', MActorSummary>
453e83ea 91
0283eaac
C
92export type MChannelSummaryAccount = MChannelSummary &
93 Use<'Account', MAccountSummaryBlocks>
453e83ea 94
0283eaac
C
95export type MChannelAPI = MChannel &
96 Use<'Actor', MActorAPI> &
97 Use<'Account', MAccountAPI>