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