]>
Commit | Line | Data |
---|---|---|
453e83ea C |
1 | import { VideoPlaylistModel } from '../../../models/video/video-playlist' |
2 | import { PickWith } from '../../utils' | |
1ca9f7c3 | 3 | import { MAccount, MAccountDefault, MAccountSummary, MAccountSummaryFormattable } from '../account' |
453e83ea | 4 | import { MThumbnail } from './thumbnail' |
b5fecbf4 | 5 | import { MChannelDefault, MChannelSummary, MChannelSummaryFormattable, MChannelUrl } from './video-channels' |
453e83ea C |
6 | import { MVideoPlaylistElementLight } from '@server/typings/models/video/video-playlist-element' |
7 | ||
0283eaac C |
8 | type Use<K extends keyof VideoPlaylistModel, M> = PickWith<VideoPlaylistModel, K, M> |
9 | ||
10 | // ############################################################################ | |
11 | ||
453e83ea | 12 | export type MVideoPlaylist = Omit<VideoPlaylistModel, 'OwnerAccount' | 'VideoChannel' | 'VideoPlaylistElements' | 'Thumbnail'> |
0283eaac C |
13 | |
14 | // ############################################################################ | |
15 | ||
453e83ea C |
16 | export type MVideoPlaylistId = Pick<MVideoPlaylist, 'id'> |
17 | export type MVideoPlaylistPrivacy = Pick<MVideoPlaylist, 'privacy'> | |
0283eaac | 18 | export type MVideoPlaylistUUID = Pick<MVideoPlaylist, 'uuid'> |
1ca9f7c3 | 19 | export type MVideoPlaylistVideosLength = MVideoPlaylist & { videosLength?: number } |
0283eaac C |
20 | |
21 | // ############################################################################ | |
22 | ||
23 | // With elements | |
453e83ea | 24 | |
a1587156 C |
25 | export type MVideoPlaylistWithElements = |
26 | MVideoPlaylist & | |
0283eaac | 27 | Use<'VideoPlaylistElements', MVideoPlaylistElementLight[]> |
453e83ea | 28 | |
a1587156 C |
29 | export type MVideoPlaylistIdWithElements = |
30 | MVideoPlaylistId & | |
0283eaac C |
31 | Use<'VideoPlaylistElements', MVideoPlaylistElementLight[]> |
32 | ||
33 | // ############################################################################ | |
34 | ||
35 | // With account | |
453e83ea | 36 | |
a1587156 C |
37 | export type MVideoPlaylistOwner = |
38 | MVideoPlaylist & | |
0283eaac | 39 | Use<'OwnerAccount', MAccount> |
453e83ea | 40 | |
a1587156 C |
41 | export type MVideoPlaylistOwnerDefault = |
42 | MVideoPlaylist & | |
0283eaac C |
43 | Use<'OwnerAccount', MAccountDefault> |
44 | ||
45 | // ############################################################################ | |
46 | ||
47 | // With thumbnail | |
453e83ea | 48 | |
a1587156 C |
49 | export type MVideoPlaylistThumbnail = |
50 | MVideoPlaylist & | |
0283eaac | 51 | Use<'Thumbnail', MThumbnail> |
453e83ea | 52 | |
a1587156 C |
53 | export type MVideoPlaylistAccountThumbnail = |
54 | MVideoPlaylist & | |
0283eaac C |
55 | Use<'OwnerAccount', MAccountDefault> & |
56 | Use<'Thumbnail', MThumbnail> | |
453e83ea | 57 | |
0283eaac C |
58 | // ############################################################################ |
59 | ||
60 | // With channel | |
453e83ea | 61 | |
a1587156 C |
62 | export type MVideoPlaylistAccountChannelDefault = |
63 | MVideoPlaylist & | |
0283eaac C |
64 | Use<'OwnerAccount', MAccountDefault> & |
65 | Use<'VideoChannel', MChannelDefault> | |
453e83ea | 66 | |
0283eaac | 67 | // ############################################################################ |
453e83ea | 68 | |
0283eaac C |
69 | // With all associations |
70 | ||
a1587156 C |
71 | export type MVideoPlaylistFull = |
72 | MVideoPlaylist & | |
0283eaac C |
73 | Use<'OwnerAccount', MAccountDefault> & |
74 | Use<'VideoChannel', MChannelDefault> & | |
75 | Use<'Thumbnail', MThumbnail> | |
76 | ||
77 | // ############################################################################ | |
78 | ||
79 | // For API | |
80 | ||
a1587156 C |
81 | export type MVideoPlaylistAccountChannelSummary = |
82 | MVideoPlaylist & | |
0283eaac C |
83 | Use<'OwnerAccount', MAccountSummary> & |
84 | Use<'VideoChannel', MChannelSummary> | |
453e83ea | 85 | |
a1587156 C |
86 | export type MVideoPlaylistFullSummary = |
87 | MVideoPlaylist & | |
0283eaac C |
88 | Use<'Thumbnail', MThumbnail> & |
89 | Use<'OwnerAccount', MAccountSummary> & | |
90 | Use<'VideoChannel', MChannelSummary> | |
1ca9f7c3 C |
91 | |
92 | // ############################################################################ | |
93 | ||
94 | // Format for API or AP object | |
95 | ||
a1587156 C |
96 | export type MVideoPlaylistFormattable = |
97 | MVideoPlaylistVideosLength & | |
1ca9f7c3 C |
98 | Use<'OwnerAccount', MAccountSummaryFormattable> & |
99 | Use<'VideoChannel', MChannelSummaryFormattable> | |
b5fecbf4 | 100 | |
a1587156 C |
101 | export type MVideoPlaylistAP = |
102 | MVideoPlaylist & | |
b5fecbf4 C |
103 | Use<'Thumbnail', MThumbnail> & |
104 | Use<'VideoChannel', MChannelUrl> |