diff options
author | Chocobozzz <me@florianbigard.com> | 2020-06-18 10:45:25 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-06-18 10:46:27 +0200 |
commit | 26d6bf6533023326fa017812cf31bbe20c752d36 (patch) | |
tree | 9c4e3ecdc344420190f17d429bdf05d78fae7a8c /server/types/models/video/video-playlist-element.ts | |
parent | d6d951ddc0c492f3261065b5dcb4df0534d252fc (diff) | |
download | PeerTube-26d6bf6533023326fa017812cf31bbe20c752d36.tar.gz PeerTube-26d6bf6533023326fa017812cf31bbe20c752d36.tar.zst PeerTube-26d6bf6533023326fa017812cf31bbe20c752d36.zip |
Split types and typings
Diffstat (limited to 'server/types/models/video/video-playlist-element.ts')
-rw-r--r-- | server/types/models/video/video-playlist-element.ts | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/server/types/models/video/video-playlist-element.ts b/server/types/models/video/video-playlist-element.ts new file mode 100644 index 000000000..c50992da7 --- /dev/null +++ b/server/types/models/video/video-playlist-element.ts | |||
@@ -0,0 +1,39 @@ | |||
1 | import { VideoPlaylistElementModel } from '@server/models/video/video-playlist-element' | ||
2 | import { PickWith } from '@server/types/utils' | ||
3 | import { MVideoFormattable, MVideoThumbnail, MVideoUrl } from './video' | ||
4 | import { MVideoPlaylistPrivacy } from './video-playlist' | ||
5 | |||
6 | type Use<K extends keyof VideoPlaylistElementModel, M> = PickWith<VideoPlaylistElementModel, K, M> | ||
7 | |||
8 | // ############################################################################ | ||
9 | |||
10 | export type MVideoPlaylistElement = Omit<VideoPlaylistElementModel, 'VideoPlaylist' | 'Video'> | ||
11 | |||
12 | // ############################################################################ | ||
13 | |||
14 | export type MVideoPlaylistElementId = Pick<MVideoPlaylistElement, 'id'> | ||
15 | |||
16 | export type MVideoPlaylistElementLight = Pick<MVideoPlaylistElement, 'id' | 'videoId' | 'startTimestamp' | 'stopTimestamp'> | ||
17 | |||
18 | // ############################################################################ | ||
19 | |||
20 | export type MVideoPlaylistVideoThumbnail = | ||
21 | MVideoPlaylistElement & | ||
22 | Use<'Video', MVideoThumbnail> | ||
23 | |||
24 | export type MVideoPlaylistElementVideoUrlPlaylistPrivacy = | ||
25 | MVideoPlaylistElement & | ||
26 | Use<'Video', MVideoUrl> & | ||
27 | Use<'VideoPlaylist', MVideoPlaylistPrivacy> | ||
28 | |||
29 | // ############################################################################ | ||
30 | |||
31 | // Format for API or AP object | ||
32 | |||
33 | export type MVideoPlaylistElementFormattable = | ||
34 | MVideoPlaylistElement & | ||
35 | Use<'Video', MVideoFormattable> | ||
36 | |||
37 | export type MVideoPlaylistElementAP = | ||
38 | MVideoPlaylistElement & | ||
39 | Use<'Video', MVideoUrl> | ||