diff --git a/api/apps/api/src/migrations/api/1695040870835-AddClonePieceForProjectCostSurfaces.ts b/api/apps/api/src/migrations/api/1695040870835-AddClonePieceForProjectCostSurfaces.ts index 5eec1a2665..7eb4800da7 100644 --- a/api/apps/api/src/migrations/api/1695040870835-AddClonePieceForProjectCostSurfaces.ts +++ b/api/apps/api/src/migrations/api/1695040870835-AddClonePieceForProjectCostSurfaces.ts @@ -1,15 +1,15 @@ -import { MigrationInterface, QueryRunner } from "typeorm" +import { MigrationInterface, QueryRunner } from 'typeorm'; -export class AddClonePieceForProjectCostSurfaces1695040870835 implements MigrationInterface { - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TYPE clone_piece_enum ADD VALUE 'project-cost-surfaces'`, - ); - } +export class AddClonePieceForProjectCostSurfaces1695040870835 + implements MigrationInterface { + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query( + `ALTER TYPE clone_piece_enum ADD VALUE 'project-cost-surfaces'`, + ); + } - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query(` + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(` CREATE TYPE "clone_piece_enum_tmp" AS ENUM( 'export-config', 'project-metadata', @@ -33,21 +33,20 @@ export class AddClonePieceForProjectCostSurfaces1695040870835 implements Migrati ); `); - await queryRunner.query(` + await queryRunner.query(` ALTER TABLE export_components ALTER COLUMN piece TYPE clone_piece_enum_tmp; `); - await queryRunner.query(` + await queryRunner.query(` ALTER TABLE import_components ALTER COLUMN piece TYPE clone_piece_enum_tmp; `); - await queryRunner.query(` + await queryRunner.query(` DROP TYPE clone_piece_enum; `); - await queryRunner.query(` + await queryRunner.query(` ALTER TYPE clone_piece_enum_tmp RENAME TO clone_piece_enum; `); - } - + } } diff --git a/api/apps/api/src/modules/scenarios/protected-area/getter/selection-get.service.ts b/api/apps/api/src/modules/scenarios/protected-area/getter/selection-get.service.ts index 34b8d66775..bdd0df1959 100644 --- a/api/apps/api/src/modules/scenarios/protected-area/getter/selection-get.service.ts +++ b/api/apps/api/src/modules/scenarios/protected-area/getter/selection-get.service.ts @@ -69,7 +69,7 @@ export class SelectionGetService { return [ ...categories.map((category) => ({ - name: 'IUCN '+ category, + name: 'IUCN ' + category, id: category, isCustom: false, })), diff --git a/api/apps/geoprocessing/src/export/pieces-exporters/pieces-exporters.module.ts b/api/apps/geoprocessing/src/export/pieces-exporters/pieces-exporters.module.ts index 818aee6040..0f0e3cfb8e 100644 --- a/api/apps/geoprocessing/src/export/pieces-exporters/pieces-exporters.module.ts +++ b/api/apps/geoprocessing/src/export/pieces-exporters/pieces-exporters.module.ts @@ -30,9 +30,7 @@ import { ScenarioOutputFolderPieceExporter } from './scenario-output-folder.piec import { ScenarioPlanningUnitsDataPieceExporter } from './scenario-planning-units-data.piece-exporter'; import { ScenarioProtectedAreasPieceExporter } from './scenario-protected-areas.piece-exporter'; import { ScenarioRunResultsPieceExporter } from './scenario-run-results.piece-exporter'; -import { - ProjectCostSurfacesPieceExporter -} from "@marxan-geoprocessing/export/pieces-exporters/project-cost-surfaces.piece-exporter"; +import { ProjectCostSurfacesPieceExporter } from '@marxan-geoprocessing/export/pieces-exporters/project-cost-surfaces.piece-exporter'; @Module({ imports: [ diff --git a/api/apps/geoprocessing/src/export/pieces-exporters/project-cost-surfaces.piece-exporter.ts b/api/apps/geoprocessing/src/export/pieces-exporters/project-cost-surfaces.piece-exporter.ts index 6087b90015..5f62748979 100644 --- a/api/apps/geoprocessing/src/export/pieces-exporters/project-cost-surfaces.piece-exporter.ts +++ b/api/apps/geoprocessing/src/export/pieces-exporters/project-cost-surfaces.piece-exporter.ts @@ -84,7 +84,10 @@ export class ProjectCostSurfacesPieceExporter implements ExportPieceProcessor { const fileContent: ProjectCostSurfacesContent = { costSurfaces: costSurfaces.map(({ id, ...costSurface }) => ({ ...costSurface, - data: costSurfaceData.filter((data : CostSurfaceDataSelectResult) => data.cost_surface_id === id) + data: costSurfaceData + .filter( + (data: CostSurfaceDataSelectResult) => data.cost_surface_id === id, + ) .map(({ cost_surface_id, projects_pu_id, ...data }) => { const puid = projectPusMap[projects_pu_id]; return { puid, ...data }; diff --git a/api/apps/geoprocessing/src/import/pieces-importers/pieces-importers.module.ts b/api/apps/geoprocessing/src/import/pieces-importers/pieces-importers.module.ts index f85becdbe8..6d797e537e 100644 --- a/api/apps/geoprocessing/src/import/pieces-importers/pieces-importers.module.ts +++ b/api/apps/geoprocessing/src/import/pieces-importers/pieces-importers.module.ts @@ -19,9 +19,7 @@ import { ScenarioMetadataPieceImporter } from './scenario-metadata.piece-importe import { ScenarioPlanningUnitsDataPieceImporter } from './scenario-planning-units-data.piece-importer'; import { ScenarioProtectedAreasPieceImporter } from './scenario-protected-areas.piece-importer'; import { ScenarioRunResultsPieceImporter } from './scenario-run-results.piece-importer'; -import { - ProjectCostSurfacesPieceImporter -} from "@marxan-geoprocessing/import/pieces-importers/project-cost-surfaces.piece-importer"; +import { ProjectCostSurfacesPieceImporter } from '@marxan-geoprocessing/import/pieces-importers/project-cost-surfaces.piece-importer'; @Module({ imports: [ diff --git a/api/apps/geoprocessing/src/import/pieces-importers/project-cost-surfaces.piece-importer.ts b/api/apps/geoprocessing/src/import/pieces-importers/project-cost-surfaces.piece-importer.ts index 078ee599d8..5ab1ee5b2a 100644 --- a/api/apps/geoprocessing/src/import/pieces-importers/project-cost-surfaces.piece-importer.ts +++ b/api/apps/geoprocessing/src/import/pieces-importers/project-cost-surfaces.piece-importer.ts @@ -19,14 +19,13 @@ import { ProjectsPuEntity } from '@marxan-jobs/planning-unit-geometry'; import { CHUNK_SIZE_FOR_BATCH_GEODB_OPERATIONS } from '@marxan-geoprocessing/utils/chunk-size-for-batch-geodb-operations'; import { CostSurfaceData, - ProjectCostSurfacesContent -} from "@marxan/cloning/infrastructure/clone-piece-data/project-cost-surfaces"; -import { CostSurfacePuDataEntity } from "@marxan/cost-surfaces"; + ProjectCostSurfacesContent, +} from '@marxan/cloning/infrastructure/clone-piece-data/project-cost-surfaces'; +import { CostSurfacePuDataEntity } from '@marxan/cost-surfaces'; @Injectable() @PieceImportProvider() -export class ProjectCostSurfacesPieceImporter - implements ImportPieceProcessor { +export class ProjectCostSurfacesPieceImporter implements ImportPieceProcessor { private readonly logger: Logger = new Logger( ProjectCostSurfacesPieceImporter.name, ); @@ -41,8 +40,7 @@ export class ProjectCostSurfacesPieceImporter isSupported(piece: ClonePiece, kind: ResourceKind): boolean { return ( - piece === ClonePiece.ProjectCostSurfaces && - kind === ResourceKind.Project + piece === ClonePiece.ProjectCostSurfaces && kind === ResourceKind.Project ); } @@ -99,22 +97,21 @@ export class ProjectCostSurfacesPieceImporter }); const costSurfaceData = data.map((data: CostSurfaceData) => ({ - ...data, - cost_surface_id: costSurfaceId, - })) - + ...data, + cost_surface_id: costSurfaceId, + })); const costSurfaceInsertData = costSurfaceData.map( (data: CostSurfaceData) => ({ costSurfaceId: costSurfaceId, cost: data.cost, projectsPuId: projectPusMap[data.puid], - }), ); - costSurfacesDataInsertValues = costSurfacesDataInsertValues.concat(costSurfaceInsertData); - + costSurfacesDataInsertValues = costSurfacesDataInsertValues.concat( + costSurfaceInsertData, + ); }); await Promise.all(