diff --git a/src/app/shared/models/gb3-api-generated.interfaces.ts b/src/app/shared/models/gb3-api-generated.interfaces.ts index e282ed1d..fe572eda 100644 --- a/src/app/shared/models/gb3-api-generated.interfaces.ts +++ b/src/app/shared/models/gb3-api-generated.interfaces.ts @@ -678,8 +678,8 @@ export interface Contact { export interface Dataset { /** UUID */ uuid: string; - /** Link auf Bild */ - image_url: string | null; + /** image object of the thumbnail image */ + image_url: Image; /** Verfügbarkeit OGD/NOGD */ ogd: boolean; /** Kontakt: Verantwortlich für Geodaten */ @@ -951,24 +951,24 @@ export type InfoFeatureField = label: string; /** Field value (string, numeric or null) */ value: string | number | null; - /** type for the link object */ - type: string; + /** type for the text object (here 'text') */ + type: 'text'; } | { /** Field label */ label: string; /** Field link */ value: LinkObject; - /** type for the link object */ - type: string; + /** type for the link object (here 'link') */ + type: 'link'; } | { /** Field label */ label: string; /** Field image */ value: Image; - /** type for the image object */ - type: string; + /** type for the image object (here 'image') */ + type: 'image'; }; /** A link MUST be represented as either: a string containing the link’s URL or a link object. */ @@ -992,10 +992,10 @@ export interface LinkObject { export interface Map { /** Map UUID */ uuid: string; - /** Link auf Bild */ - image_url: string | null; + /** image object of the thumbnail image */ + image_url: Image; /** Kontakt: Verantwortlich für Geodaten */ - kontakt_geodaten: Contact; + kontakt_metadaten: Contact; /** Map GB2-Nummer */ gb2_id: number; /** Topic name */ @@ -1047,8 +1047,8 @@ export interface MunicipalityItem { export interface Product { /** Product UUID */ uuid: string; - /** Link auf Bild */ - image_url: string | null; + /** image object of the thumbnail image */ + image_url: Image; /** Kontakt: Zuständig für Geometadaten */ kontakt_metadaten: Contact; /** Product GDP-Nummer */ @@ -1125,8 +1125,8 @@ export interface SearchMatch { export interface Service { /** Service UUID */ uuid: string; - /** Link auf Bild */ - image_url: string | null; + /** image object of the thumbnail image */ + image_url: Image; /** Kontakt: Zuständig für Geometadaten */ kontakt_metadaten: Contact; /** Service GDSer-Nummer */ diff --git a/src/app/shared/services/apis/gb3/gb3-metadata.service.ts b/src/app/shared/services/apis/gb3/gb3-metadata.service.ts index 48ffb7bd..5dceea54 100644 --- a/src/app/shared/services/apis/gb3/gb3-metadata.service.ts +++ b/src/app/shared/services/apis/gb3/gb3-metadata.service.ts @@ -185,7 +185,7 @@ export class Gb3MetadataService extends Gb3ApiService { mxd: dataset.mxd ? this.createLinkObject(dataset.mxd) : null, lyr: dataset.lyrs, pdf: dataset.pdf ? {href: this.createAbsoluteUrl(dataset.pdf.href), title: dataset.pdf.title} : null, - imageUrl: dataset.image_url ? this.createAbsoluteUrl(dataset.image_url) : null, + imageUrl: dataset.image_url ? this.createAbsoluteUrl(dataset.image_url.src.href) : null, contact: { geodata: this.extractContactDetails(dataset.kontakt_geodaten), metadata: this.extractContactDetails(dataset.kontakt_metadaten), @@ -220,7 +220,7 @@ export class Gb3MetadataService extends Gb3ApiService { gisZHNr: mapData.gb2_id, name: mapData.name, description: mapData.beschreibung, - imageUrl: mapData.image_url ? this.createAbsoluteUrl(mapData.image_url) : null, + imageUrl: mapData.image_url ? this.createAbsoluteUrl(mapData.image_url.src.href) : null, externalLinks: mapData.verweise, gb2Url: mapData.gb2_url ? { @@ -230,7 +230,7 @@ export class Gb3MetadataService extends Gb3ApiService { : null, datasets: mapData.datasets.map(this.extractDatasetDetail), contact: { - geodata: this.extractContactDetails(mapData.kontakt_geodaten), + geodata: this.extractContactDetails(mapData.kontakt_metadaten), }, }; } @@ -249,7 +249,7 @@ export class Gb3MetadataService extends Gb3ApiService { datasets: service.datasets.map(this.extractDatasetDetail), serviceType: service.servicetyp, description: service.beschreibung, - imageUrl: service.image_url ? this.createAbsoluteUrl(service.image_url) : null, + imageUrl: service.image_url ? this.createAbsoluteUrl(service.image_url.src.href) : null, }; } @@ -262,7 +262,7 @@ export class Gb3MetadataService extends Gb3ApiService { metadata: this.extractContactDetails(product.kontakt_metadaten), }, description: product.beschreibung, - imageUrl: product.image_url ? this.createAbsoluteUrl(product.image_url) : null, + imageUrl: product.image_url ? this.createAbsoluteUrl(product.image_url.src.href) : null, datasets: product.datasets.map(this.extractDatasetDetail), }; } diff --git a/src/app/shared/services/apis/gb3/gb3-topics.service.ts b/src/app/shared/services/apis/gb3/gb3-topics.service.ts index c74723ef..cf4705d6 100644 --- a/src/app/shared/services/apis/gb3/gb3-topics.service.ts +++ b/src/app/shared/services/apis/gb3/gb3-topics.service.ts @@ -371,19 +371,16 @@ export class Gb3TopicsService extends Gb3ApiService { } private createFeatureInfoFieldValue(field: InfoFeatureField): string | LinkObject | Image | null { - if (field.value === null) { - return null; - } - if (typeof field.value === 'number') { - return field.value.toString(); - } - if (typeof field.value === 'string' || 'alt' in field.value) { - return field.value; - } else { - return { - title: field.value.title, - href: field.value.href, - }; + switch (field.type) { + case 'image': + return field.value; + case 'link': + return { + title: field.value.title, + href: field.value.href, + }; + case 'text': + return typeof field.value === 'number' ? field.value.toString() : null; } } }