diff --git a/api/apps/api/src/modules/scenarios/scenario.api.entity.ts b/api/apps/api/src/modules/scenarios/scenario.api.entity.ts index 50063b25c0..6d59ee9fa0 100644 --- a/api/apps/api/src/modules/scenarios/scenario.api.entity.ts +++ b/api/apps/api/src/modules/scenarios/scenario.api.entity.ts @@ -15,6 +15,7 @@ import { TimeUserEntityMetadata } from '../../types/time-user-entity-metadata'; import { BaseServiceResource } from '../../types/resource.interface'; import { JsonApiAsyncJobMeta } from '@marxan-api/dto/async-job.dto'; import { ScenarioBlm } from '@marxan-api/modules/blm/values/repositories/scenario-blm/scenario-blm.api.entity'; +import { CostSurface } from '@marxan-api/modules/cost-surface/cost-surface.api.entity'; export const scenarioResource: BaseServiceResource = { className: 'Scenario', diff --git a/api/apps/geoprocessing/test/integration/cloning/fixtures.ts b/api/apps/geoprocessing/test/integration/cloning/fixtures.ts index c39eacb759..236747b047 100644 --- a/api/apps/geoprocessing/test/integration/cloning/fixtures.ts +++ b/api/apps/geoprocessing/test/integration/cloning/fixtures.ts @@ -154,8 +154,8 @@ export async function GivenScenarioExists( organizationId: string, scenarioData: Record = {}, projectData: Record = {}, + costSurfaceId = v4(), ) { - const costSurfaceId = v4(); await GivenProjectExists( em, projectId, diff --git a/api/apps/geoprocessing/test/integration/cloning/piece-exporters/scenario-metadata.piece-exporter.e2e-spec.ts b/api/apps/geoprocessing/test/integration/cloning/piece-exporters/scenario-metadata.piece-exporter.e2e-spec.ts index 8bd00abeab..2a006fe6d9 100644 --- a/api/apps/geoprocessing/test/integration/cloning/piece-exporters/scenario-metadata.piece-exporter.e2e-spec.ts +++ b/api/apps/geoprocessing/test/integration/cloning/piece-exporters/scenario-metadata.piece-exporter.e2e-spec.ts @@ -83,6 +83,7 @@ const getFixtures = async () => { const projectId = v4(); const scenarioId = v4(); + const costSurfaceId = v4(); const organizationId = v4(); const sut = sandbox.get(ScenarioMetadataPieceExporter); const apiEntityManager: EntityManager = sandbox.get( @@ -105,6 +106,7 @@ const getFixtures = async () => { ranAtLeastOnce: false, solutionsAreLocked, type: 'marxan', + cost_surface_id: costSurfaceId, }); return { @@ -140,6 +142,8 @@ const getFixtures = async () => { metadata: { marxanInputParameterFile: { meta: '1' } }, solutions_are_locked: solutionsAreLocked, }, + {}, + costSurfaceId, ); }, GivenScenarioBlmRangeExist: async () => { diff --git a/api/apps/geoprocessing/test/integration/cloning/piece-importers/scenario-metadata.piece-importer.e2e-spec.ts b/api/apps/geoprocessing/test/integration/cloning/piece-importers/scenario-metadata.piece-importer.e2e-spec.ts index 068d3bfd43..7df623ff60 100644 --- a/api/apps/geoprocessing/test/integration/cloning/piece-importers/scenario-metadata.piece-importer.e2e-spec.ts +++ b/api/apps/geoprocessing/test/integration/cloning/piece-importers/scenario-metadata.piece-importer.e2e-spec.ts @@ -151,6 +151,7 @@ const getFixtures = async () => { const organizationId = v4(); const oldScenarioId = v4(); const userId = v4(); + const costSurfaceId = v4(); const sut = sandbox.get(ScenarioMetadataPieceImporter); const fileRepository = sandbox.get(CloningFilesRepository); @@ -175,6 +176,7 @@ const getFixtures = async () => { solutionsAreLocked, projectScenarioId: 1, type: 'marxan', + cost_surface_id: costSurfaceId, }); return { @@ -197,6 +199,9 @@ const getFixtures = async () => { scenarioId, projectId, organizationId, + {}, + {}, + costSurfaceId, ); }, GivenJobInput: ( diff --git a/api/libs/cloning/src/infrastructure/clone-piece-data/index.ts b/api/libs/cloning/src/infrastructure/clone-piece-data/index.ts index 3971efb1aa..e65dea42a1 100644 --- a/api/libs/cloning/src/infrastructure/clone-piece-data/index.ts +++ b/api/libs/cloning/src/infrastructure/clone-piece-data/index.ts @@ -1,6 +1,6 @@ import { isDefined } from '../../../../utils/src'; import { SlugService } from '../../../../utils/src/slug.service'; -import { ComponentLocation, ResourceKind } from '../../domain'; +import { ResourceKind } from '../../domain'; import { ClonePiece } from '../../domain/clone-piece'; import { exportConfigRelativePath } from './export-config'; import { marxanExecutionMetadataRelativePath } from './marxan-execution-metadata'; @@ -55,22 +55,23 @@ export const clonePieceImportOrder: Record = { // [ClonePiece.ProjectMetadata]: 0, // - [ClonePiece.ScenarioMetadata]: 1, [ClonePiece.PlanningAreaGAdm]: 1, [ClonePiece.PlanningAreaCustom]: 1, [ClonePiece.PlanningUnitsGrid]: 1, [ClonePiece.ProjectCustomProtectedAreas]: 1, // - [ClonePiece.ProjectCustomFeatures]: 2, - [ClonePiece.ScenarioProtectedAreas]: 2, - [ClonePiece.ScenarioPlanningUnitsData]: 2, + [ClonePiece.ScenarioMetadata]: 2, // - [ClonePiece.ProjectPuvsprCalculations]: 3, - [ClonePiece.ScenarioFeaturesData]: 3, + [ClonePiece.ProjectCustomFeatures]: 3, + [ClonePiece.ScenarioProtectedAreas]: 3, + [ClonePiece.ScenarioPlanningUnitsData]: 3, // - [ClonePiece.ScenarioRunResults]: 4, - [ClonePiece.MarxanExecutionMetadata]: 4, - [ClonePiece.FeaturesSpecification]: 4, + [ClonePiece.ProjectPuvsprCalculations]: 4, + [ClonePiece.ScenarioFeaturesData]: 4, + // + [ClonePiece.ScenarioRunResults]: 5, + [ClonePiece.MarxanExecutionMetadata]: 5, + [ClonePiece.FeaturesSpecification]: 5, }; export class ClonePieceRelativePathResolver {