]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/types/models/video/video-playlist.ts
Add ability to search playlists
[github/Chocobozzz/PeerTube.git] / server / types / models / video / video-playlist.ts
CommitLineData
453e83ea 1import { VideoPlaylistModel } from '../../../models/video/video-playlist'
67ed6552 2import { PickWith } from '@shared/core-utils'
1ca9f7c3 3import { MAccount, MAccountDefault, MAccountSummary, MAccountSummaryFormattable } from '../account'
453e83ea 4import { MThumbnail } from './thumbnail'
b5fecbf4 5import { MChannelDefault, MChannelSummary, MChannelSummaryFormattable, MChannelUrl } from './video-channels'
26d6bf65 6import { MVideoPlaylistElementLight } from '@server/types/models/video/video-playlist-element'
453e83ea 7
0283eaac
C
8type Use<K extends keyof VideoPlaylistModel, M> = PickWith<VideoPlaylistModel, K, M>
9
10// ############################################################################
11
453e83ea 12export type MVideoPlaylist = Omit<VideoPlaylistModel, 'OwnerAccount' | 'VideoChannel' | 'VideoPlaylistElements' | 'Thumbnail'>
0283eaac
C
13
14// ############################################################################
15
453e83ea
C
16export type MVideoPlaylistId = Pick<MVideoPlaylist, 'id'>
17export type MVideoPlaylistPrivacy = Pick<MVideoPlaylist, 'privacy'>
0283eaac 18export type MVideoPlaylistUUID = Pick<MVideoPlaylist, 'uuid'>
1ca9f7c3 19export type MVideoPlaylistVideosLength = MVideoPlaylist & { videosLength?: number }
0283eaac
C
20
21// ############################################################################
22
23// With elements
453e83ea 24
a1587156
C
25export type MVideoPlaylistWithElements =
26 MVideoPlaylist &
0283eaac 27 Use<'VideoPlaylistElements', MVideoPlaylistElementLight[]>
453e83ea 28
a1587156
C
29export type MVideoPlaylistIdWithElements =
30 MVideoPlaylistId &
0283eaac
C
31 Use<'VideoPlaylistElements', MVideoPlaylistElementLight[]>
32
33// ############################################################################
34
35// With account
453e83ea 36
a1587156
C
37export type MVideoPlaylistOwner =
38 MVideoPlaylist &
0283eaac 39 Use<'OwnerAccount', MAccount>
453e83ea 40
a1587156
C
41export type MVideoPlaylistOwnerDefault =
42 MVideoPlaylist &
0283eaac
C
43 Use<'OwnerAccount', MAccountDefault>
44
45// ############################################################################
46
47// With thumbnail
453e83ea 48
a1587156
C
49export type MVideoPlaylistThumbnail =
50 MVideoPlaylist &
0283eaac 51 Use<'Thumbnail', MThumbnail>
453e83ea 52
a1587156
C
53export 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
62export 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 71export type MVideoPlaylistFull =
37a44fc9 72 MVideoPlaylistVideosLength &
0283eaac
C
73 Use<'OwnerAccount', MAccountDefault> &
74 Use<'VideoChannel', MChannelDefault> &
75 Use<'Thumbnail', MThumbnail>
76
77// ############################################################################
78
79// For API
80
a1587156
C
81export type MVideoPlaylistAccountChannelSummary =
82 MVideoPlaylist &
0283eaac
C
83 Use<'OwnerAccount', MAccountSummary> &
84 Use<'VideoChannel', MChannelSummary>
453e83ea 85
a1587156 86export type MVideoPlaylistFullSummary =
37a44fc9 87 MVideoPlaylistVideosLength &
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
96export type MVideoPlaylistFormattable =
97 MVideoPlaylistVideosLength &
1ca9f7c3
C
98 Use<'OwnerAccount', MAccountSummaryFormattable> &
99 Use<'VideoChannel', MChannelSummaryFormattable>
b5fecbf4 100
a1587156
C
101export type MVideoPlaylistAP =
102 MVideoPlaylist &
b5fecbf4
C
103 Use<'Thumbnail', MThumbnail> &
104 Use<'VideoChannel', MChannelUrl>