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