]>
Commit | Line | Data |
---|---|---|
d6886027 C |
1 | import { pick } from '@shared/core-utils' |
2 | import { | |
3 | VideoChannelsSearchQueryAfterSanitize, | |
4 | VideoPlaylistsSearchQueryAfterSanitize, | |
5 | VideosCommonQueryAfterSanitize, | |
6 | VideosSearchQueryAfterSanitize | |
7 | } from '@shared/models' | |
8 | ||
9 | function pickCommonVideoQuery (query: VideosCommonQueryAfterSanitize) { | |
10 | return pick(query, [ | |
11 | 'start', | |
12 | 'count', | |
13 | 'sort', | |
14 | 'nsfw', | |
15 | 'isLive', | |
16 | 'categoryOneOf', | |
17 | 'licenceOneOf', | |
18 | 'languageOneOf', | |
527a52ac | 19 | 'privacyOneOf', |
d6886027 C |
20 | 'tagsOneOf', |
21 | 'tagsAllOf', | |
2760b454 C |
22 | 'isLocal', |
23 | 'include', | |
24 | 'skipCount', | |
d324756e C |
25 | 'hasHLSFiles', |
26 | 'hasWebtorrentFiles', | |
2a4c0d8b W |
27 | 'search', |
28 | 'excludeAlreadyWatched' | |
d6886027 C |
29 | ]) |
30 | } | |
31 | ||
32 | function pickSearchVideoQuery (query: VideosSearchQueryAfterSanitize) { | |
33 | return { | |
34 | ...pickCommonVideoQuery(query), | |
35 | ||
36 | ...pick(query, [ | |
37 | 'searchTarget', | |
d6886027 C |
38 | 'host', |
39 | 'startDate', | |
40 | 'endDate', | |
41 | 'originallyPublishedStartDate', | |
42 | 'originallyPublishedEndDate', | |
43 | 'durationMin', | |
44 | 'durationMax', | |
2a4c0d8b W |
45 | 'uuids', |
46 | 'excludeAlreadyWatched' | |
d6886027 C |
47 | ]) |
48 | } | |
49 | } | |
50 | ||
51 | function pickSearchChannelQuery (query: VideoChannelsSearchQueryAfterSanitize) { | |
52 | return pick(query, [ | |
53 | 'searchTarget', | |
54 | 'search', | |
55 | 'start', | |
56 | 'count', | |
57 | 'sort', | |
58 | 'host', | |
59 | 'handles' | |
60 | ]) | |
61 | } | |
62 | ||
63 | function pickSearchPlaylistQuery (query: VideoPlaylistsSearchQueryAfterSanitize) { | |
64 | return pick(query, [ | |
65 | 'searchTarget', | |
66 | 'search', | |
67 | 'start', | |
68 | 'count', | |
69 | 'sort', | |
70 | 'host', | |
71 | 'uuids' | |
72 | ]) | |
73 | } | |
74 | ||
75 | export { | |
76 | pickCommonVideoQuery, | |
77 | pickSearchVideoQuery, | |
78 | pickSearchPlaylistQuery, | |
79 | pickSearchChannelQuery | |
80 | } |