From f04764c130aab317ebb37ad49a5b15c8edd5eb13 Mon Sep 17 00:00:00 2001 From: alexeh Date: Tue, 26 Sep 2023 03:37:41 +0300 Subject: [PATCH] Update column name --- .../adapters/project/typeorm-project-cost-surface.ts | 4 ++-- .../planning-units-grid/planning-units-grid.processor.ts | 2 +- .../src/modules/planning-units/planning-units.job.ts | 2 +- .../planning-unit-grid/planning-units-grid.fixtures.ts | 2 +- api/apps/geoprocessing/test/steps/given-projects-pu-exists.ts | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/api/apps/geoprocessing/src/modules/cost-surface/adapters/project/typeorm-project-cost-surface.ts b/api/apps/geoprocessing/src/modules/cost-surface/adapters/project/typeorm-project-cost-surface.ts index 3118a69b0c..9c9d194a32 100644 --- a/api/apps/geoprocessing/src/modules/cost-surface/adapters/project/typeorm-project-cost-surface.ts +++ b/api/apps/geoprocessing/src/modules/cost-surface/adapters/project/typeorm-project-cost-surface.ts @@ -26,7 +26,7 @@ export class TypeormProjectCostSurface CostSurfacePuDataEntity, rows.map((row) => ({ cost: row.cost, - puid: row.projectsPuId, + projectsPuId: row.projectsPuId, costSurfaceId: row.costSurfaceId, })), ); @@ -70,7 +70,7 @@ export class TypeormProjectCostSurface */ await this.geoprocessingEntityManager.query( ` - INSERT INTO cost_surface_pu_data (puid, cost, cost_surface_id) + INSERT INTO cost_surface_pu_data (projects_pu_id, cost, cost_surface_id) SELECT ppu.id, round(pug.area / 1000000) as area, $2 FROM projects_pu ppu INNER JOIN planning_units_geom pug ON pug.id = ppu.geom_id diff --git a/api/apps/geoprocessing/src/modules/planning-area/planning-units-grid/planning-units-grid.processor.ts b/api/apps/geoprocessing/src/modules/planning-area/planning-units-grid/planning-units-grid.processor.ts index 7b73a90fb1..a25f545ed4 100644 --- a/api/apps/geoprocessing/src/modules/planning-area/planning-units-grid/planning-units-grid.processor.ts +++ b/api/apps/geoprocessing/src/modules/planning-area/planning-units-grid/planning-units-grid.processor.ts @@ -63,7 +63,7 @@ export class PlanningUnitsGridProcessor { // TODO: Maybe add a custom method in the repo, share it in libs to be used in both sides const projectPuIds = projectPus.map((p) => p.id); await manager.query( - `INSERT INTO cost_surface_pu_data (puid, cost, cost_surface_id) + `INSERT INTO cost_surface_pu_data (projects_pu_id, cost, cost_surface_id) SELECT ppu.id, round(pug.area / 1000000) as area, ppu.id FROM projects_pu ppu INNER JOIN planning_units_geom pug ON pug.id = ppu.geom_id diff --git a/api/apps/geoprocessing/src/modules/planning-units/planning-units.job.ts b/api/apps/geoprocessing/src/modules/planning-units/planning-units.job.ts index 4e2d8f0a77..36f26c97aa 100644 --- a/api/apps/geoprocessing/src/modules/planning-units/planning-units.job.ts +++ b/api/apps/geoprocessing/src/modules/planning-units/planning-units.job.ts @@ -247,7 +247,7 @@ grid.geom ids.map((geometryId: string) => { return em.query( ` - INSERT INTO cost_surface_pu_data (puid, cost, cost_surface_id) + INSERT INTO cost_surface_pu_data (projects_pu_id, cost, cost_surface_id) SELECT ppu.id, round(pug.area / 1000000) as area, $1 FROM projects_pu ppu INNER JOIN planning_units_geom pug ON pug.id = ppu.geom_id diff --git a/api/apps/geoprocessing/test/integration/planning-unit-grid/planning-units-grid.fixtures.ts b/api/apps/geoprocessing/test/integration/planning-unit-grid/planning-units-grid.fixtures.ts index f9ac3235b9..db9bf09ae0 100644 --- a/api/apps/geoprocessing/test/integration/planning-unit-grid/planning-units-grid.fixtures.ts +++ b/api/apps/geoprocessing/test/integration/planning-unit-grid/planning-units-grid.fixtures.ts @@ -146,7 +146,7 @@ export const getFixtures = async () => { }, async ThenThePUCostOfThatPlanningAreaIsCreated(planingAreaId: string) { const costForPlanningArea = await puGeoRepo.query( - `select * from cost_surface_pu_data join projects_pu pp on cost_surface_pu_data.puid = pp.id where pp.planning_area_id = $1`, + `select * from cost_surface_pu_data join projects_pu pp on cost_surface_pu_data.projects_pu_id = pp.id where pp.planning_area_id = $1`, [planingAreaId], ); const pusForProject = await projectsPuRepo.query( diff --git a/api/apps/geoprocessing/test/steps/given-projects-pu-exists.ts b/api/apps/geoprocessing/test/steps/given-projects-pu-exists.ts index 16ea47dd9c..00d1a9da0e 100644 --- a/api/apps/geoprocessing/test/steps/given-projects-pu-exists.ts +++ b/api/apps/geoprocessing/test/steps/given-projects-pu-exists.ts @@ -77,7 +77,7 @@ export const GivenCostSurfacePuDataExists = async ( .getRepository(ProjectsPuEntity) .findOneOrFail({ where: { projectId } }); await entityManager.query( - `INSERT INTO cost_surface_pu_data (puid, cost, cost_surface_id) + `INSERT INTO cost_surface_pu_data (projects_pu_id, cost, cost_surface_id) SELECT ppu.id, round(pug.area / 1000000) as area, $1 FROM projects_pu ppu INNER JOIN planning_units_geom pug ON pug.id = ppu.geom_id