aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/types/models/video/video-playlist.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-06-18 10:45:25 +0200
committerChocobozzz <me@florianbigard.com>2020-06-18 10:46:27 +0200
commit26d6bf6533023326fa017812cf31bbe20c752d36 (patch)
tree9c4e3ecdc344420190f17d429bdf05d78fae7a8c /server/types/models/video/video-playlist.ts
parentd6d951ddc0c492f3261065b5dcb4df0534d252fc (diff)
downloadPeerTube-26d6bf6533023326fa017812cf31bbe20c752d36.tar.gz
PeerTube-26d6bf6533023326fa017812cf31bbe20c752d36.tar.zst
PeerTube-26d6bf6533023326fa017812cf31bbe20c752d36.zip
Split types and typings
Diffstat (limited to 'server/types/models/video/video-playlist.ts')
-rw-r--r--server/types/models/video/video-playlist.ts104
1 files changed, 104 insertions, 0 deletions
diff --git a/server/types/models/video/video-playlist.ts b/server/types/models/video/video-playlist.ts
new file mode 100644
index 000000000..b504d1664
--- /dev/null
+++ b/server/types/models/video/video-playlist.ts
@@ -0,0 +1,104 @@
1import { VideoPlaylistModel } from '../../../models/video/video-playlist'
2import { PickWith } from '../../utils'
3import { MAccount, MAccountDefault, MAccountSummary, MAccountSummaryFormattable } from '../account'
4import { MThumbnail } from './thumbnail'
5import { MChannelDefault, MChannelSummary, MChannelSummaryFormattable, MChannelUrl } from './video-channels'
6import { MVideoPlaylistElementLight } from '@server/types/models/video/video-playlist-element'
7
8type Use<K extends keyof VideoPlaylistModel, M> = PickWith<VideoPlaylistModel, K, M>
9
10// ############################################################################
11
12export type MVideoPlaylist = Omit<VideoPlaylistModel, 'OwnerAccount' | 'VideoChannel' | 'VideoPlaylistElements' | 'Thumbnail'>
13
14// ############################################################################
15
16export type MVideoPlaylistId = Pick<MVideoPlaylist, 'id'>
17export type MVideoPlaylistPrivacy = Pick<MVideoPlaylist, 'privacy'>
18export type MVideoPlaylistUUID = Pick<MVideoPlaylist, 'uuid'>
19export type MVideoPlaylistVideosLength = MVideoPlaylist & { videosLength?: number }
20
21// ############################################################################
22
23// With elements
24
25export type MVideoPlaylistWithElements =
26 MVideoPlaylist &
27 Use<'VideoPlaylistElements', MVideoPlaylistElementLight[]>
28
29export type MVideoPlaylistIdWithElements =
30 MVideoPlaylistId &
31 Use<'VideoPlaylistElements', MVideoPlaylistElementLight[]>
32
33// ############################################################################
34
35// With account
36
37export type MVideoPlaylistOwner =
38 MVideoPlaylist &
39 Use<'OwnerAccount', MAccount>
40
41export type MVideoPlaylistOwnerDefault =
42 MVideoPlaylist &
43 Use<'OwnerAccount', MAccountDefault>
44
45// ############################################################################
46
47// With thumbnail
48
49export type MVideoPlaylistThumbnail =
50 MVideoPlaylist &
51 Use<'Thumbnail', MThumbnail>
52
53export type MVideoPlaylistAccountThumbnail =
54 MVideoPlaylist &
55 Use<'OwnerAccount', MAccountDefault> &
56 Use<'Thumbnail', MThumbnail>
57
58// ############################################################################
59
60// With channel
61
62export type MVideoPlaylistAccountChannelDefault =
63 MVideoPlaylist &
64 Use<'OwnerAccount', MAccountDefault> &
65 Use<'VideoChannel', MChannelDefault>
66
67// ############################################################################
68
69// With all associations
70
71export type MVideoPlaylistFull =
72 MVideoPlaylist &
73 Use<'OwnerAccount', MAccountDefault> &
74 Use<'VideoChannel', MChannelDefault> &
75 Use<'Thumbnail', MThumbnail>
76
77// ############################################################################
78
79// For API
80
81export type MVideoPlaylistAccountChannelSummary =
82 MVideoPlaylist &
83 Use<'OwnerAccount', MAccountSummary> &
84 Use<'VideoChannel', MChannelSummary>
85
86export type MVideoPlaylistFullSummary =
87 MVideoPlaylist &
88 Use<'Thumbnail', MThumbnail> &
89 Use<'OwnerAccount', MAccountSummary> &
90 Use<'VideoChannel', MChannelSummary>
91
92// ############################################################################
93
94// Format for API or AP object
95
96export type MVideoPlaylistFormattable =
97 MVideoPlaylistVideosLength &
98 Use<'OwnerAccount', MAccountSummaryFormattable> &
99 Use<'VideoChannel', MChannelSummaryFormattable>
100
101export type MVideoPlaylistAP =
102 MVideoPlaylist &
103 Use<'Thumbnail', MThumbnail> &
104 Use<'VideoChannel', MChannelUrl>