fix(patents): restore patent detail API and align frontend service types
LocationBasedServices/smartguide/pipeline/pr-dev This commit looks good

Re-add getPatentByIdOrTitle endpoint and OrgPatentMatchTypeFilter export
lost during dev merge; update institution-patents to use options-based API.
This commit is contained in:
2026-07-06 13:57:47 +02:00
parent eb89076070
commit de4ba0591e
6 changed files with 152 additions and 10 deletions
+17 -2
View File
@@ -368,12 +368,26 @@ export class PatentsService extends BaseService {
}
public getPatentById(patentId: string): Observable<PatentEntry> {
return this.getPatentByIdOrTitle(patentId);
}
public getPatentByIdOrTitle(
identifier: string,
prefix?: string,
title?: string,
fillingDate?: string,
): Observable<PatentEntry> {
let params = new HttpParams();
if (prefix) params = params.set('prefix', prefix);
if (title) params = params.set('title', title);
if (fillingDate) params = params.set('filling_date', fillingDate);
const localVarHeaders = this.defaultHeaders;
const { basePath, withCredentials } = this.configuration;
const localVarPath = `/api/inse-service/patents/${this.configuration.encodeParam(
{
name: 'patentId',
value: patentId,
name: 'identifier',
value: identifier,
in: 'path',
style: 'simple',
explode: false,
@@ -383,6 +397,7 @@ export class PatentsService extends BaseService {
)}`;
return this.httpClient.get<PatentEntry>(`${basePath}${localVarPath}`, {
params,
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
});
@@ -9,6 +9,8 @@
*/
import { OrgPatentEntry } from './orgPatentEntry';
export type OrgPatentMatchTypeFilter = 'all' | 'institution' | 'name' | 'both';
export interface OrgPatentsResponse {
institution_id: string;
institution_name?: string | null;
@@ -130,13 +130,13 @@ export class InstitutionPatentsComponent implements OnInit {
this.error = false;
this.patentsApi
.getOrgPatentsByInstitution(
institutionId,
this.activeMatchType,
this.selectedPage - 1,
this.pageSize,
this.activeFilter !== 'all' ? this.activeFilter : undefined,
)
.getOrgPatentsByInstitution(institutionId, 'body', false, {
matchType:
this.activeMatchType !== 'all' ? this.activeMatchType : undefined,
page: this.selectedPage - 1,
size: this.pageSize,
source: this.activeFilter !== 'all' ? this.activeFilter : undefined,
})
.subscribe({
next: (result) => {
this.patents = result.patents ?? [];
@@ -128,7 +128,7 @@ export class PatentDetailComponent implements OnInit {
.getPatentByIdOrTitle(patentId, prefix, title, fillingDate)
.pipe(finalize(() => (this.loading = false)))
.subscribe({
next: (patent) => {
next: (patent: PatentEntry) => {
this.patent = patent;
},
error: () => {