diff --git a/webapp/src/app/resolvers/bund-projects.resolver.ts b/webapp/src/app/resolvers/bund-projects.resolver.ts index 4dd3e63f..78e8269a 100644 --- a/webapp/src/app/resolvers/bund-projects.resolver.ts +++ b/webapp/src/app/resolvers/bund-projects.resolver.ts @@ -11,7 +11,7 @@ export const bundProjectQueryParamKeys = { size: 'size', title: 'title', authorId: 'authorId', - funding_art: 'funding_art', + funding_type: 'funding_type', institutionId: 'institutionId', funding_start: 'funding_start', funding_end: 'funding_end', @@ -20,13 +20,15 @@ export const bundProjectQueryParamKeys = { sortDirection: 'sort_direction', legend: 'legend', legend_expanded: 'legend_expanded', + keywords: 'keywords', + topics: 'topics', + agency: 'agency', } as const; export const bundProjectsResolver: ResolveFn = ( route, state, ) => { - console.log('bundProjectsResolver called with route:', route); const page = route.queryParamMap.get(bundProjectQueryParamKeys.page) ?? '0'; const size = route.queryParamMap.get(bundProjectQueryParamKeys.size) ?? '10'; const institutionIds = route.queryParamMap.getAll( @@ -38,34 +40,43 @@ export const bundProjectsResolver: ResolveFn = ( const fundingEndYears = route.queryParamMap.getAll( bundProjectQueryParamKeys.funding_end, ); - const topicIds = route.queryParamMap.get(bundProjectQueryParamKeys.topicId); - const fundingArts = route.queryParamMap.getAll( - bundProjectQueryParamKeys.funding_art, + const keywords = + route.queryParamMap.get(bundProjectQueryParamKeys.keywords)?.split(',') || + []; + const topicIds = route.queryParamMap.getAll( + bundProjectQueryParamKeys.topicId, + ); + const topics = route.queryParamMap.getAll(bundProjectQueryParamKeys.topics); + const fundingType = route.queryParamMap.getAll( + bundProjectQueryParamKeys.funding_type, ); const sortBy = (route.queryParamMap.get(bundProjectQueryParamKeys.sortBy) || 'title') as ProjectsSortBy; const sortDirection = (route.queryParamMap.get( bundProjectQueryParamKeys.sortDirection, ) || 'asc') as SortDirection; - + const fuzzySearch = route.queryParamMap.get('fuzzy') === 'true'; const search = route.queryParamMap.get(bundProjectQueryParamKeys.title) || undefined; + const executingAgency = route.queryParamMap.getAll( + bundProjectQueryParamKeys.agency, + ); return inject(ProjectsService).searchBundProjectsWithFilters( - institutionIds, - fundingArts, + executingAgency, + fundingType, search, - [], - [], - [], + keywords, + topics, + topicIds, fundingStartYears, fundingEndYears, [], - [], + institutionIds, Number(page), Number(size), sortBy, sortDirection, - false, + fuzzySearch, ); }; diff --git a/webapp/src/app/resolvers/selected-bund-institutions.resolver.ts b/webapp/src/app/resolvers/selected-bund-institutions.resolver.ts new file mode 100644 index 00000000..a9155dac --- /dev/null +++ b/webapp/src/app/resolvers/selected-bund-institutions.resolver.ts @@ -0,0 +1,15 @@ +import { inject } from '@angular/core'; +import { ResolveFn } from '@angular/router'; +import { BUNDInstitutionsService } from '../api'; +import { BundInstitutionSummaryPage } from '../api/model/bundInstitutionSummaryPage'; + +export const selectedBundInstitutionsResolver: ResolveFn< + BundInstitutionSummaryPage +> = (route, state) => { + const agencyNameQueryParamKey = + (route.data['institutionIdQueryParamKey'] as string) || 'agency'; + + const agencies = route.queryParamMap.getAll(agencyNameQueryParamKey); + + return inject(BUNDInstitutionsService).getBundInstitutionsByName(agencies); +};