diff options
author | Chocobozzz <me@florianbigard.com> | 2019-08-15 11:53:26 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-08-19 17:26:35 +0200 |
commit | 453e83ea5d81d203ba34bc43cd5c2c750ba40568 (patch) | |
tree | 604e02f4343d13a4ba42e1fb7527ba6ab9111712 /server/typings/models/video/video-channels.ts | |
parent | 13176a07a95984a53cc59aec5217f2ce9806d1bc (diff) | |
download | PeerTube-453e83ea5d81d203ba34bc43cd5c2c750ba40568.tar.gz PeerTube-453e83ea5d81d203ba34bc43cd5c2c750ba40568.tar.zst PeerTube-453e83ea5d81d203ba34bc43cd5c2c750ba40568.zip |
Stronger model typings
Diffstat (limited to 'server/typings/models/video/video-channels.ts')
-rw-r--r-- | server/typings/models/video/video-channels.ts | 70 |
1 files changed, 70 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..e10bd6842 --- /dev/null +++ b/server/typings/models/video/video-channels.ts | |||
@@ -0,0 +1,70 @@ | |||
1 | import { FunctionProperties, PickWith } from '../../utils' | ||
2 | import { VideoChannelModel } from '../../../models/video/video-channel' | ||
3 | import { | ||
4 | MAccountActor, | ||
5 | MAccountAPI, | ||
6 | MAccountBlocks, | ||
7 | MAccountDefault, | ||
8 | MAccountLight, | ||
9 | MAccountUserId, | ||
10 | MActor, | ||
11 | MActorAccountChannelId, | ||
12 | MActorAPI, | ||
13 | MActorDefault, | ||
14 | MActorDefaultLight, MActorLight, | ||
15 | MActorSummary | ||
16 | } from '../account' | ||
17 | import { MVideo } from './video' | ||
18 | |||
19 | export type MChannelId = FunctionProperties<VideoChannelModel> | ||
20 | export type MChannelIdActor = MChannelId & | ||
21 | PickWith<VideoChannelModel, 'Actor', MActorAccountChannelId> | ||
22 | |||
23 | export type MChannel = Omit<VideoChannelModel, 'Actor' | 'Account' | 'Videos' | 'VideoPlaylists'> | ||
24 | |||
25 | export type MChannelUserId = Pick<MChannel, 'accountId'> & | ||
26 | PickWith<VideoChannelModel, 'Account', MAccountUserId> | ||
27 | |||
28 | // Default scope | ||
29 | export type MChannelDefault = MChannel & | ||
30 | PickWith<VideoChannelModel, 'Actor', MActorDefault> | ||
31 | |||
32 | export type MChannelLight = MChannel & | ||
33 | PickWith<VideoChannelModel, 'Actor', MActorDefaultLight> | ||
34 | |||
35 | export type MChannelAccountLight = MChannel & | ||
36 | PickWith<VideoChannelModel, 'Actor', MActorDefaultLight> & | ||
37 | PickWith<VideoChannelModel, 'Account', MAccountLight> | ||
38 | |||
39 | export type MChannelSummary = Pick<MChannel, 'id' | 'name' | 'description' | 'actorId'> & | ||
40 | PickWith<VideoChannelModel, 'Actor', MActorSummary> | ||
41 | |||
42 | export type MChannelSummaryAccount = MChannelSummary & | ||
43 | PickWith<VideoChannelModel, 'Account', MAccountBlocks> | ||
44 | |||
45 | export type MChannelAPI = MChannel & | ||
46 | PickWith<VideoChannelModel, 'Actor', MActorAPI> & | ||
47 | PickWith<VideoChannelModel, 'Account', MAccountAPI> | ||
48 | |||
49 | export type MChannelAccountActor = MChannel & | ||
50 | PickWith<VideoChannelModel, 'Account', MAccountActor> | ||
51 | export type MChannelAccountDefault = MChannelActor & | ||
52 | PickWith<VideoChannelModel, 'Account', MAccountDefault> | ||
53 | |||
54 | export type MChannelVideos = MChannel & | ||
55 | PickWith<VideoChannelModel, 'Videos', MVideo[]> | ||
56 | |||
57 | export type MChannelActor = MChannel & | ||
58 | PickWith<VideoChannelModel, 'Actor', MActor> | ||
59 | export type MChannelActorLight = MChannel & | ||
60 | PickWith<VideoChannelModel, 'Actor', MActorLight> | ||
61 | export type MChannelActorDefault = MChannel & | ||
62 | PickWith<VideoChannelModel, 'Actor', MActorDefault> | ||
63 | |||
64 | export type MChannelActorAccountActor = MChannelAccountActor & MChannelActor | ||
65 | |||
66 | export type MChannelActorAccountDefault = MChannel & | ||
67 | PickWith<VideoChannelModel, 'Actor', MActorDefault> & | ||
68 | PickWith<VideoChannelModel, 'Account', MAccountDefault> | ||
69 | |||
70 | export type MChannelActorAccountDefaultVideos = MChannelActorAccountDefault & MChannelVideos | ||