From 577cc8fe7af81e90fc7daebd39edd316aed3f830 Mon Sep 17 00:00:00 2001 From: genja Date: Mon, 20 Jul 2026 01:20:56 +0200 Subject: [PATCH] added resolvers for dfg authors and institutions filters --- .../selected-dfg-authors.resolver.ts | 22 +++++++++++++++++++ .../selected-dfg-institutions.resolver.ts | 17 ++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 webapp/src/app/resolvers/selected-dfg-authors.resolver.ts create mode 100644 webapp/src/app/resolvers/selected-dfg-institutions.resolver.ts diff --git a/webapp/src/app/resolvers/selected-dfg-authors.resolver.ts b/webapp/src/app/resolvers/selected-dfg-authors.resolver.ts new file mode 100644 index 00000000..c932e13d --- /dev/null +++ b/webapp/src/app/resolvers/selected-dfg-authors.resolver.ts @@ -0,0 +1,22 @@ +import { ResolveFn } from '@angular/router'; +import { inject } from '@angular/core'; + +import { DFGPersonsService } from '../api'; +import { DfgPersonSummaryPage } from '../api/model/dfgPersonSummaryPage'; + +export const selectedDfgAuthorsResolver: ResolveFn = ( + route, + state, +) => { + const authorIdQueryParamKey = + (route.data['authorIdQueryParamKey'] as string) || 'authorId'; + + const authorIds = route.queryParamMap.getAll(authorIdQueryParamKey); + if (authorIds.length === 0) { + return { elements: [] }; + } + + return inject(DFGPersonsService).getDfgPersonsByIds( + authorIds.map((id) => id.trim()).filter((id) => id.length > 0), + ); +}; diff --git a/webapp/src/app/resolvers/selected-dfg-institutions.resolver.ts b/webapp/src/app/resolvers/selected-dfg-institutions.resolver.ts new file mode 100644 index 00000000..f8e595bf --- /dev/null +++ b/webapp/src/app/resolvers/selected-dfg-institutions.resolver.ts @@ -0,0 +1,17 @@ +import { inject } from '@angular/core'; +import { ResolveFn } from '@angular/router'; +import { DFGInstitutionsService } from '../api'; +import { DfgInstitutionSummaryPage } from '../api/model/dfgInstitutionSummaryPage'; + +export const selectedDfgInstitutionsResolver: ResolveFn< + DfgInstitutionSummaryPage +> = (route, state) => { + const institutionIdQueryParamKey = + (route.data['institutionIdQueryParamKey'] as string) || 'institutionId'; + + const institutionIds = route.queryParamMap.getAll(institutionIdQueryParamKey); + + return inject(DFGInstitutionsService).getDfgInstitutionsByIds( + institutionIds.map((id) => id.trim()).filter((id) => id.length > 0), + ); +};