From 7a22a0a56aa75fbb1ba986a5d2c606e1343f30c2 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 5 May 2021 12:10:00 +0200 Subject: Add ability to search live videos --- .../app/shared/shared-search/advanced-search.model.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'client/src/app/shared') diff --git a/client/src/app/shared/shared-search/advanced-search.model.ts b/client/src/app/shared/shared-search/advanced-search.model.ts index 0e3924841..2c83f53b6 100644 --- a/client/src/app/shared/shared-search/advanced-search.model.ts +++ b/client/src/app/shared/shared-search/advanced-search.model.ts @@ -1,4 +1,4 @@ -import { BooleanBothQuery, SearchTargetType } from '@shared/models' +import { BooleanBothQuery, BooleanQuery, SearchTargetType, VideosSearchQuery } from '@shared/models' export class AdvancedSearch { startDate: string // ISO 8601 @@ -21,6 +21,8 @@ export class AdvancedSearch { durationMin: number // seconds durationMax: number // seconds + isLive: BooleanQuery + sort: string searchTarget: SearchTargetType @@ -41,6 +43,8 @@ export class AdvancedSearch { tagsOneOf?: any tagsAllOf?: any + isLive?: BooleanQuery + durationMin?: string durationMax?: string sort?: string @@ -54,6 +58,8 @@ export class AdvancedSearch { this.originallyPublishedEndDate = options.originallyPublishedEndDate || undefined this.nsfw = options.nsfw || undefined + this.isLive = options.isLive || undefined + this.categoryOneOf = options.categoryOneOf || undefined this.licenceOneOf = options.licenceOneOf || undefined this.languageOneOf = options.languageOneOf || undefined @@ -94,6 +100,7 @@ export class AdvancedSearch { this.tagsAllOf = undefined this.durationMin = undefined this.durationMax = undefined + this.isLive = undefined this.sort = '-match' } @@ -112,12 +119,16 @@ export class AdvancedSearch { tagsAllOf: this.tagsAllOf, durationMin: this.durationMin, durationMax: this.durationMax, + isLive: this.isLive, sort: this.sort, searchTarget: this.searchTarget } } - toAPIObject () { + toAPIObject (): VideosSearchQuery { + let isLive: boolean + if (this.isLive) isLive = this.isLive === 'true' + return { startDate: this.startDate, endDate: this.endDate, @@ -131,6 +142,7 @@ export class AdvancedSearch { tagsAllOf: this.tagsAllOf, durationMin: this.durationMin, durationMax: this.durationMax, + isLive, sort: this.sort, searchTarget: this.searchTarget } -- cgit v1.2.3