]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/helpers/query.ts
Fix s3 mock cleanup
[github/Chocobozzz/PeerTube.git] / server / helpers / query.ts
CommitLineData
d6886027
C
1import { pick } from '@shared/core-utils'
2import {
3 VideoChannelsSearchQueryAfterSanitize,
4 VideoPlaylistsSearchQueryAfterSanitize,
5 VideosCommonQueryAfterSanitize,
6 VideosSearchQueryAfterSanitize
7} from '@shared/models'
8
9function 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
32function 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
51function pickSearchChannelQuery (query: VideoChannelsSearchQueryAfterSanitize) {
52 return pick(query, [
53 'searchTarget',
54 'search',
55 'start',
56 'count',
57 'sort',
58 'host',
59 'handles'
60 ])
61}
62
63function pickSearchPlaylistQuery (query: VideoPlaylistsSearchQueryAfterSanitize) {
64 return pick(query, [
65 'searchTarget',
66 'search',
67 'start',
68 'count',
69 'sort',
70 'host',
71 'uuids'
72 ])
73}
74
75export {
76 pickCommonVideoQuery,
77 pickSearchVideoQuery,
78 pickSearchPlaylistQuery,
79 pickSearchChannelQuery
80}