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