diff --git a/api/apps/api/src/modules/projects/project-cost-surface.controller.ts b/api/apps/api/src/modules/projects/project-cost-surface.controller.ts index c9975eab1c..7d3aefb47b 100644 --- a/api/apps/api/src/modules/projects/project-cost-surface.controller.ts +++ b/api/apps/api/src/modules/projects/project-cost-surface.controller.ts @@ -7,7 +7,6 @@ import { Get, Inject, Param, - ParseIntPipe, ParseUUIDPipe, Patch, Post, @@ -49,7 +48,6 @@ import { import { ensureShapefileHasRequiredFiles } from '@marxan-api/utils/file-uploads.utils'; import { UpdateCostSurfaceDto } from '@marxan-api/modules/cost-surface/dto/update-cost-surface.dto'; import { CostSurfaceSerializer } from '@marxan-api/modules/cost-surface/dto/cost-surface.serializer'; -import { TilesOpenApi } from '@marxan/tiles'; import { Response } from 'express'; import { ProxyService } from '@marxan-api/modules/proxy/proxy.service'; import { @@ -273,15 +271,30 @@ export class ProjectCostSurfaceController { name: 'projectId', description: 'The id of the Project that the Cost Surface is associated to', }) - @Get(':projectId/cost-surface/:costSurfaceId/preview/tiles/:z/:x/:y.mvt') + @ApiParam({ + name: 'z', + description: 'The zoom level ranging from 0 - 20', + type: Number, + required: true, + }) + @ApiParam({ + name: 'x', + description: 'The tile x offset on Mercator Projection', + type: Number, + required: true, + }) + @ApiParam({ + name: 'y', + description: 'The tile y offset on Mercator Projection', + type: Number, + required: true, + }) + @Get(':projectId/cost-surfaces/:costSurfaceId/preview/tiles/:z/:x/:y.mvt') async proxyCostSurfaceTile( @Req() req: RequestWithAuthenticatedUser, @Res() response: Response, @Param('projectId', ParseUUIDPipe) projectId: string, @Param('costSurfaceId', ParseUUIDPipe) costSurfaceId: string, - @Param('z', ParseIntPipe) z: number, - @Param('x', ParseIntPipe) x: number, - @Param('y', ParseIntPipe) y: number, ): Promise { const checkCostSurfaceForProject = await this.costSurfaceService.checkProjectCostSurfaceVisibility( req.user.id, @@ -293,8 +306,8 @@ export class ProjectCostSurfaceController { } req.url = req.url.replace( - `projects/${projectId}/cost-surface/`, - `cost-surfaces/`, + `projects/${projectId}/`, + ``, ); return await this.proxyService.proxyTileRequest(req, response); diff --git a/api/apps/geoprocessing/src/modules/cost-surface/cost-surface.controller.ts b/api/apps/geoprocessing/src/modules/cost-surface/cost-surface.controller.ts index 571225209e..8f2b1e0153 100644 --- a/api/apps/geoprocessing/src/modules/cost-surface/cost-surface.controller.ts +++ b/api/apps/geoprocessing/src/modules/cost-surface/cost-surface.controller.ts @@ -1,20 +1,15 @@ import { Controller, Get, - Header, Logger, Param, - Query, Res, } from '@nestjs/common'; import { apiGlobalPrefixes } from '@marxan-geoprocessing/api.config'; import { ApiBadRequestResponse, ApiOperation, - ApiParam, - ApiQuery, } from '@nestjs/swagger'; -import { BBox } from 'geojson'; import { Response } from 'express'; import { setTileResponseHeadersForSuccessfulRequests } from '@marxan/tiles'; @@ -32,37 +27,6 @@ export class CostSurfaceController { @ApiOperation({ description: 'Get tile for a cost surface by id.', }) - @ApiParam({ - name: 'z', - description: 'The zoom level ranging from 0 - 20', - type: Number, - required: true, - }) - @ApiParam({ - name: 'x', - description: 'The tile x offset on Mercator Projection', - type: Number, - required: true, - }) - @ApiParam({ - name: 'y', - description: 'The tile y offset on Mercator Projection', - type: Number, - required: true, - }) - @ApiParam({ - name: 'id', - description: 'Specific id of the cost surface', - type: String, - required: true, - }) - @ApiQuery({ - name: 'bbox', - description: 'Bounding box of the project', - type: [Number], - required: false, - example: [-1, 40, 1, 42], - }) @Get(':costSurfaceId/preview/tiles/:z/:x/:y.mvt') @ApiBadRequestResponse() async getTile( diff --git a/api/apps/geoprocessing/src/modules/cost-surface/cost-surface.service.ts b/api/apps/geoprocessing/src/modules/cost-surface/cost-surface.service.ts index cfa2c3e21f..a1d2a676b6 100644 --- a/api/apps/geoprocessing/src/modules/cost-surface/cost-surface.service.ts +++ b/api/apps/geoprocessing/src/modules/cost-surface/cost-surface.service.ts @@ -1,13 +1,10 @@ import { Injectable, Logger, Inject } from '@nestjs/common'; import { TileService } from '@marxan-geoprocessing/modules/tile/tile.service'; -import { InjectRepository } from '@nestjs/typeorm'; -import { Repository } from 'typeorm'; import { IsArray, IsNumber, IsString, IsOptional } from 'class-validator'; import { ApiProperty } from '@nestjs/swagger'; import { Transform } from 'class-transformer'; import { BBox } from 'geojson'; import { antimeridianBbox, nominatim2bbox } from '@marxan/utils/geo'; - import { TileRequest } from '@marxan/tiles'; import { CostSurfacePuDataEntity } from '@marxan/cost-surfaces'; @@ -34,8 +31,6 @@ export class CostSurfaceService { private readonly logger: Logger = new Logger(CostSurfaceService.name); constructor( - @InjectRepository(CostSurfacePuDataEntity) - private readonly costSurfaceDataRepository: Repository, private readonly tileService: TileService, ) {}