diff --git a/src/commands/importExportEntities/entities/taxonomies.ts b/src/commands/importExportEntities/entities/taxonomies.ts index 14e43b59..12a3adb4 100644 --- a/src/commands/importExportEntities/entities/taxonomies.ts +++ b/src/commands/importExportEntities/entities/taxonomies.ts @@ -17,7 +17,7 @@ export const taxonomiesEntity: EntityDefinition res.data._raw); }), @@ -36,11 +36,14 @@ export const taxonomiesEntity: EntityDefinition ({ - ...taxonomy, - external_id: taxonomy.external_id ?? taxonomy.codename, - terms: taxonomy.terms.map(addExternalIds), -}); +const createAddExternalIds = + (group: TaxonomyContracts.ITaxonomyContract) => + (taxonomy: TaxonomyContracts.ITaxonomyContract): TaxonomyContracts.ITaxonomyContract => ({ + ...taxonomy, + external_id: taxonomy.external_id + ?? (taxonomy === group ? group.codename : `${group.codename}_${taxonomy.codename}`), + terms: taxonomy.terms.map(createAddExternalIds(group)), + }); const extractTermIdsEntries = ( [fileTaxonomy, projectTaxonomy]: readonly [TaxonomyContracts.ITaxonomyContract, TaxonomyContracts.ITaxonomyContract],