aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/search/search.service.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/search/search.service.ts')
-rw-r--r--client/src/app/search/search.service.ts17
1 files changed, 16 insertions, 1 deletions
diff --git a/client/src/app/search/search.service.ts b/client/src/app/search/search.service.ts
index 02d5f5915..c6106afd6 100644
--- a/client/src/app/search/search.service.ts
+++ b/client/src/app/search/search.service.ts
@@ -8,6 +8,7 @@ import { RestExtractor, RestService } from '@app/shared'
8import { environment } from 'environments/environment' 8import { environment } from 'environments/environment'
9import { ResultList, Video } from '../../../../shared' 9import { ResultList, Video } from '../../../../shared'
10import { Video as VideoServerModel } from '@app/shared/video/video.model' 10import { Video as VideoServerModel } from '@app/shared/video/video.model'
11import { AdvancedSearch } from '@app/search/advanced-search.model'
11 12
12export type SearchResult = { 13export type SearchResult = {
13 videosResult: { totalVideos: number, videos: Video[] } 14 videosResult: { totalVideos: number, videos: Video[] }
@@ -26,7 +27,8 @@ export class SearchService {
26 27
27 searchVideos ( 28 searchVideos (
28 search: string, 29 search: string,
29 componentPagination: ComponentPagination 30 componentPagination: ComponentPagination,
31 advancedSearch: AdvancedSearch
30 ): Observable<{ videos: Video[], totalVideos: number }> { 32 ): Observable<{ videos: Video[], totalVideos: number }> {
31 const url = SearchService.BASE_SEARCH_URL + 'videos' 33 const url = SearchService.BASE_SEARCH_URL + 'videos'
32 34
@@ -36,6 +38,19 @@ export class SearchService {
36 params = this.restService.addRestGetParams(params, pagination) 38 params = this.restService.addRestGetParams(params, pagination)
37 params = params.append('search', search) 39 params = params.append('search', search)
38 40
41 const advancedSearchObject = advancedSearch.toAPIObject()
42
43 for (const name of Object.keys(advancedSearchObject)) {
44 const value = advancedSearchObject[name]
45 if (!value) continue
46
47 if (Array.isArray(value)) {
48 for (const v of value) params = params.append(name, v)
49 } else {
50 params = params.append(name, value)
51 }
52 }
53
39 return this.authHttp 54 return this.authHttp
40 .get<ResultList<VideoServerModel>>(url, { params }) 55 .get<ResultList<VideoServerModel>>(url, { params })
41 .pipe( 56 .pipe(