]>
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', | |
2760b454 | 27 | 'search' |
d6886027 C |
28 | ]) |
29 | } | |
30 | ||
31 | function pickSearchVideoQuery (query: VideosSearchQueryAfterSanitize) { | |
32 | return { | |
33 | ...pickCommonVideoQuery(query), | |
34 | ||
35 | ...pick(query, [ | |
36 | 'searchTarget', | |
d6886027 C |
37 | 'host', |
38 | 'startDate', | |
39 | 'endDate', | |
40 | 'originallyPublishedStartDate', | |
41 | 'originallyPublishedEndDate', | |
42 | 'durationMin', | |
43 | 'durationMax', | |
44 | 'uuids' | |
45 | ]) | |
46 | } | |
47 | } | |
48 | ||
49 | function pickSearchChannelQuery (query: VideoChannelsSearchQueryAfterSanitize) { | |
50 | return pick(query, [ | |
51 | 'searchTarget', | |
52 | 'search', | |
53 | 'start', | |
54 | 'count', | |
55 | 'sort', | |
56 | 'host', | |
57 | 'handles' | |
58 | ]) | |
59 | } | |
60 | ||
61 | function pickSearchPlaylistQuery (query: VideoPlaylistsSearchQueryAfterSanitize) { | |
62 | return pick(query, [ | |
63 | 'searchTarget', | |
64 | 'search', | |
65 | 'start', | |
66 | 'count', | |
67 | 'sort', | |
68 | 'host', | |
69 | 'uuids' | |
70 | ]) | |
71 | } | |
72 | ||
73 | export { | |
74 | pickCommonVideoQuery, | |
75 | pickSearchVideoQuery, | |
76 | pickSearchPlaylistQuery, | |
77 | pickSearchChannelQuery | |
78 | } |