mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-05 19:42:24 +02:00
server/server -> server/core
This commit is contained in:
parent
114327d4ce
commit
5a3d0650c9
838 changed files with 111 additions and 111 deletions
81
server/core/helpers/query.ts
Normal file
81
server/core/helpers/query.ts
Normal file
|
@ -0,0 +1,81 @@
|
|||
import { pick } from '@peertube/peertube-core-utils'
|
||||
import {
|
||||
VideoChannelsSearchQueryAfterSanitize,
|
||||
VideoPlaylistsSearchQueryAfterSanitize,
|
||||
VideosCommonQueryAfterSanitize,
|
||||
VideosSearchQueryAfterSanitize
|
||||
} from '@peertube/peertube-models'
|
||||
|
||||
function pickCommonVideoQuery (query: VideosCommonQueryAfterSanitize) {
|
||||
return pick(query, [
|
||||
'start',
|
||||
'count',
|
||||
'sort',
|
||||
'nsfw',
|
||||
'isLive',
|
||||
'categoryOneOf',
|
||||
'licenceOneOf',
|
||||
'languageOneOf',
|
||||
'privacyOneOf',
|
||||
'tagsOneOf',
|
||||
'tagsAllOf',
|
||||
'isLocal',
|
||||
'include',
|
||||
'skipCount',
|
||||
'hasHLSFiles',
|
||||
'hasWebtorrentFiles', // TODO: Remove in v7
|
||||
'hasWebVideoFiles',
|
||||
'search',
|
||||
'excludeAlreadyWatched'
|
||||
])
|
||||
}
|
||||
|
||||
function pickSearchVideoQuery (query: VideosSearchQueryAfterSanitize) {
|
||||
return {
|
||||
...pickCommonVideoQuery(query),
|
||||
|
||||
...pick(query, [
|
||||
'searchTarget',
|
||||
'host',
|
||||
'startDate',
|
||||
'endDate',
|
||||
'originallyPublishedStartDate',
|
||||
'originallyPublishedEndDate',
|
||||
'durationMin',
|
||||
'durationMax',
|
||||
'uuids',
|
||||
'excludeAlreadyWatched'
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
function pickSearchChannelQuery (query: VideoChannelsSearchQueryAfterSanitize) {
|
||||
return pick(query, [
|
||||
'searchTarget',
|
||||
'search',
|
||||
'start',
|
||||
'count',
|
||||
'sort',
|
||||
'host',
|
||||
'handles'
|
||||
])
|
||||
}
|
||||
|
||||
function pickSearchPlaylistQuery (query: VideoPlaylistsSearchQueryAfterSanitize) {
|
||||
return pick(query, [
|
||||
'searchTarget',
|
||||
'search',
|
||||
'start',
|
||||
'count',
|
||||
'sort',
|
||||
'host',
|
||||
'uuids'
|
||||
])
|
||||
}
|
||||
|
||||
export {
|
||||
pickCommonVideoQuery,
|
||||
pickSearchVideoQuery,
|
||||
pickSearchPlaylistQuery,
|
||||
pickSearchChannelQuery
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue