]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - server/helpers/query.ts
Better logs for transcoding
[github/Chocobozzz/PeerTube.git] / server / helpers / query.ts
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',
21 'filter',
22 'skipCount'
23 ])
24 }
25
26 function pickSearchVideoQuery (query: VideosSearchQueryAfterSanitize) {
27 return {
28 ...pickCommonVideoQuery(query),
29
30 ...pick(query, [
31 'searchTarget',
32 'search',
33 'host',
34 'startDate',
35 'endDate',
36 'originallyPublishedStartDate',
37 'originallyPublishedEndDate',
38 'durationMin',
39 'durationMax',
40 'uuids'
41 ])
42 }
43 }
44
45 function pickSearchChannelQuery (query: VideoChannelsSearchQueryAfterSanitize) {
46 return pick(query, [
47 'searchTarget',
48 'search',
49 'start',
50 'count',
51 'sort',
52 'host',
53 'handles'
54 ])
55 }
56
57 function pickSearchPlaylistQuery (query: VideoPlaylistsSearchQueryAfterSanitize) {
58 return pick(query, [
59 'searchTarget',
60 'search',
61 'start',
62 'count',
63 'sort',
64 'host',
65 'uuids'
66 ])
67 }
68
69 export {
70 pickCommonVideoQuery,
71 pickSearchVideoQuery,
72 pickSearchPlaylistQuery,
73 pickSearchChannelQuery
74 }