Skip to content

Commit

Permalink
fix: dont add reuseType key if value is undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
AlitaBernachot committed Jan 28, 2025
1 parent ae7439b commit ea83ce2
Show file tree
Hide file tree
Showing 3 changed files with 339 additions and 1 deletion.
11 changes: 11 additions & 0 deletions libs/api/metadata-converter/src/lib/gn4/gn4.converter.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3369,6 +3369,17 @@ describe('Gn4Converter', () => {
})
})
})

describe('full record type foo (dummy data)', () => {
it('sets the kind as a dataset and does not add reuseType property', async () => {
const record = await service.readRecord(
elasticReuseMetadataHitsFixture().hits.hits[3] as Gn4Record
)

expect(record.kind).toEqual('dataset')
expect(record).not.toHaveProperty('reuseType')
})
})
})
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ export class Gn4FieldMapper {
return {
...output,
kind,
reuseType,
...(reuseType && { reuseType }),
} as CatalogRecord
},
geom: (output, source) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13042,6 +13042,333 @@ export const elasticReuseMetadataHitsFixture = () => ({
hasfeaturecats: [],
},
},
{
_index: 'gn-records',
_type: '_doc',
_id: 'foo-foo',
_score: 7,
_ignored: [],
_source: {
docType: 'metadata',
document: '',
metadataIdentifier: 'foo-foo',
standardNameObject: {
default: 'ISO 19115:2003/19139',
langfre: 'ISO 19115:2003/19139',
},
standardVersionObject: {
default: '1.0',
langfre: '1.0',
},
resourceTypeNameObject: {
default: 'Parent',
langfre: 'Parent',
},
indexingDate: '2025-01-23T10:16:01.721Z',
dateStamp: '2024-01-25T07:44:42.137504Z',
mainLanguage: 'fre',
otherLanguage: ['ger', 'eng', 'fre'],
otherLanguageId: ['DE', 'EN', 'FR'],
cl_characterSet: [],
resourceType: ['foo'],
Org: 'TRION-climate / GeoRhena',
distributorOrg: 'TRION-climate / GeoRhena',
contact: [
{
organisation: 'TRION-climate / GeoRhena',
role: 'distributor',
email: '',
website: '',
logo: '',
individual: '',
position: '',
phone: '',
address: '',
},
],
cl_hierarchyLevel: [
{
key: 'interactiveMap',
default: 'Carte interactive',
langfre: 'Carte interactive',
langger: 'Interactive map',
langeng: 'Interactive map',
link: 'http://standards.iso.org/iso/19139/resources/gmxCodelists.xml#MD_ScopeCode',
},
],
cl_presentationForm: [
{
key: 'mapDigital',
default: 'Carte numérique',
langfre: 'Carte numérique',
langger: 'Digitale Karte',
langeng: 'Digital map',
link: 'http://standards.iso.org/iso/19139/resources/gmxCodelists.xml#CI_PresentationFormCode',
},
],
cl_status: [
{
key: 'completed',
default: 'Finalisé',
langfre: 'Finalisé',
langger: 'Abgeschlossen',
langeng: 'Completed',
link: 'http://standards.iso.org/iso/19139/resources/gmxCodelists.xml#MD_ProgressCode',
},
],
cl_type: [
{
key: 'theme',
default: 'Thème',
langfre: 'Thème',
langger: 'Thema',
langeng: 'Theme',
link: 'http://standards.iso.org/iso/19139/resources/gmxCodelists.xml#MD_KeywordTypeCode',
},
],
resourceTitleObject: {
default:
'Production, usages, recherche et distribution de l’hydrogène dans le Rhin Supérieur',
langfre:
'Production, usages, recherche et distribution de l’hydrogène dans le Rhin Supérieur',
langger:
'Herstellung, Verwendung, Forschung und Verteilung von Wasserstoff am Oberrhein',
langeng:
'Hydrogen production, use, research and distribution in the Upper Rhine region',
},
publicationDateForResource: ['2023-12-20T14:23:54.000Z'],
publicationYearForResource: '2023',
publicationMonthForResource: '2023-12',
resourceDate: [
{
type: 'publication',
date: '2023-12-20T14:23:54.000Z',
},
],
resourceTemporalDateRange: [
{
gte: '2023-12-20T14:23:54.000Z',
lte: '2023-12-20T14:23:54.000Z',
},
],
resourceAbstractObject: {
default:
'Dans le cadre du projet Interreg CO2-InnO, TRION-climat a recensé et décrit environ 50 projets sur l’hydrogène dans le Rhin supérieur. On retrouve ainsi les différents sites de production d’hydrogène, les principaux projets de recherche, les réseaux de transport et de distribution ainsi que les grands consommateurs d’hydrogène vert de la région. GeoRhena, le système d’information géographique du Rhin supérieur, a présenté ces installations sur une carte interactive des installations et projets de l’hydrogène.',
langfre:
'Dans le cadre du projet Interreg CO2-InnO, TRION-climat a recensé et décrit environ 50 projets sur l’hydrogène dans le Rhin supérieur. On retrouve ainsi les différents sites de production d’hydrogène, les principaux projets de recherche, les réseaux de transport et de distribution ainsi que les grands consommateurs d’hydrogène vert de la région. GeoRhena, le système d’information géographique du Rhin supérieur, a présenté ces installations sur une carte interactive des installations et projets de l’hydrogène.',
langger:
'Im Rahmen des Interreg-Projekts CO2-InnO hat TRION-climate rund 50 Wasserstoffprojekte am Oberrhein erfasst und beschrieben. Auf diese Weise findet man die verschiedenen Standorte der Wasserstoffproduktion, die wichtigsten Forschungsprojekte, die Transport- und Verteilungsnetze sowie die großen Abnehmer von grünem Wasserstoff in der Region. GeoRhena, das Geoinformationssystem des Oberrheins, präsentierte diese Anlagen auf einer interaktiven Karte der Wasserstoffanlagen und -projekte.',
langeng:
"As part of the Interreg CO2-InnO project, TRION-climat has identified and described around 50 hydrogen projects in the Upper Rhine region. These include hydrogen production sites, major research projects, transport and distribution networks, and major consumers of green hydrogen in the region. GeoRhena, the Upper Rhine's geographic information system, presented these facilities on an interactive map of hydrogen facilities and projects.",
},
OrgForResource: ['GeoRhena'],
pointOfContactOrgForResource: 'GeoRhena',
contactForResource: [
{
organisation: 'GeoRhena',
role: 'pointOfContact',
email: 'contact@georhena.eu',
website: '',
logo: '',
individual: '',
position: '',
phone: '',
address: '',
},
],
hasOverview: 'true',
overview: [
{
url: 'https://geoportal.georhena.eu/geonetwork/srv/api/records/be209d24-586f-48f5-b944-e284079b7823/attachments/hydrogene_mviewer.jpg',
},
],
resourceLanguage: ['fre', 'ger'],
inspireThemeNumber: '0',
hasInspireTheme: 'false',
tag: [
{
default: 'Hydrogène',
langfre: 'Hydrogène',
langger: 'Wasserstoff',
langeng: 'Hydrogen',
},
{
default: 'Innovation',
langfre: 'Innovation',
langger: 'Innovation',
langeng: 'Innovation',
},
{
default: 'Mviewer',
langfre: 'Mviewer',
},
],
tagNumber: '3',
isOpenData: 'false',
'keywordType-theme': [
{
default: 'Hydrogène',
langfre: 'Hydrogène',
langger: 'Wasserstoff',
langeng: 'Hydrogen',
},
{
default: 'Innovation',
langfre: 'Innovation',
langger: 'Innovation',
langeng: 'Innovation',
},
{
default: 'Mviewer',
langfre: 'Mviewer',
},
],
'th_otherKeywords-themeNumber': '3',
'th_otherKeywords-theme': [
{
default: 'Hydrogène',
langfre: 'Hydrogène',
langger: 'Wasserstoff',
langeng: 'Hydrogen',
},
{
default: 'Innovation',
langfre: 'Innovation',
langger: 'Innovation',
langeng: 'Innovation',
},
{
default: 'Mviewer',
langfre: 'Mviewer',
},
],
allKeywords: {
'th_otherKeywords-theme': {
title: 'otherKeywords-theme',
theme: 'theme',
keywords: [
{
default: 'Hydrogène',
langfre: 'Hydrogène',
langger: 'Wasserstoff',
langeng: 'Hydrogen',
},
{
default: 'Innovation',
langfre: 'Innovation',
langger: 'Innovation',
langeng: 'Innovation',
},
{
default: 'Mviewer',
langfre: 'Mviewer',
},
],
},
},
cl_topic: [
{
key: 'environment',
default: 'Environnement',
langfre: 'Environnement',
langger: 'Umwelt',
langeng: 'Environment',
},
],
coordinateSystem: ['EPSG:3857'],
crsDetails: [
{
code: 'EPSG:3857',
codeSpace: '',
name: 'EPSG:3857',
url: '',
},
],
format: ['WMC'],
linkUrl: [
'https://geoportal.georhena.eu/mviewer/?config=apps/hydrogene.xml',
'https://geoportal.georhena.eu/mviewer/?config=apps/wasserstoff.xml',
],
linkProtocol: [
'WWW:LINK-1.0-http--link',
'WWW:LINK-1.0-http--related',
],
linkUrlProtocolWWWLINK10httplink:
'https://geoportal.georhena.eu/mviewer/?config=apps/hydrogene.xml',
link: [
{
protocol: 'WWW:LINK-1.0-http--link',
mimeType: '',
url: 'https://geoportal.georhena.eu/mviewer/?config=apps/hydrogene.xml',
name: 'Carte interactive "Hydrogène" en français',
description: '',
function: '',
applicationProfile: '',
group: 0,
},
{
protocol: 'WWW:LINK-1.0-http--related',
mimeType: '',
url: 'https://geoportal.georhena.eu/mviewer/?config=apps/wasserstoff.xml',
name: 'Carte interactive "Hydrogène" en allemand',
description: '',
function: '',
applicationProfile: '',
group: 0,
},
],
linkUrlProtocolWWWLINK10httprelated:
'https://geoportal.georhena.eu/mviewer/?config=apps/wasserstoff.xml',
recordGroup: 'be209d24-586f-48f5-b944-e284079b7823',
recordOwner: 'Stéphane Ritzenthaler',
uuid: 'be209d24-586f-48f5-b944-e284079b7823',
displayOrder: '0',
groupPublishedId: ['986299', '1', '0'],
popularity: 42,
userinfo: 'sritzenthaler|Ritzenthaler|Stéphane|Administrator',
groupPublished: ['GeoRhena', 'all', 'intranet'],
isPublishedToAll: 'true',
record: 'record',
cat: ['maps'],
draft: 'n',
changeDate: '2024-01-25T07:45:05.215893Z',
id: '8705',
createDate: '2024-01-25T07:19:13.493164Z',
owner: '107',
groupOwner: '986299',
logo: '/images/logos/ce008f24-8e0d-45a8-97f8-9f10399f0190.png',
hasxlinks: 'false',
featureOfRecord: 'record',
extra: 'null',
documentStandard: 'iso19139',
valid: '-1',
isTemplate: 'n',
feedbackCount: '0',
rating: '0',
isHarvested: 'false',
userSavedCount: '0',
sourceCatalogue: 'ce008f24-8e0d-45a8-97f8-9f10399f0190',
},
edit: false,
canReview: false,
owner: false,
isPublishedToAll: true,
view: true,
notify: false,
download: true,
dynamic: true,
featured: false,
selected: false,
related: {
brothersAndSisters: [],
parent: [],
associated: [],
services: [],
hassources: [],
children: [],
hasfeaturecats: [],
},
},
],
},
})

0 comments on commit ea83ce2

Please sign in to comment.