added BUND institutions resolver, BUND projects desolver adjusted for the new logic

This commit is contained in:
2026-07-28 00:35:20 +02:00
parent e20f2732b3
commit e9ccfe6796
2 changed files with 39 additions and 13 deletions
@@ -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<BundProjectPage> = (
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<BundProjectPage> = (
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,
);
};
@@ -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);
};