Skip to content

Commit

Permalink
remove deprecated endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
hotzevzl committed Nov 14, 2023
1 parent f0d4e42 commit 100f2ba
Showing 1 changed file with 0 additions and 100 deletions.
100 changes: 0 additions & 100 deletions api/apps/api/src/modules/scenarios/scenarios.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -397,38 +397,6 @@ export class ScenariosController {
return await this.geoFeatureSetSerializer.serialize(result.right);
}

@ApiOperation({
deprecated: true,
description:
'To be removed soon to POST /projects/:projectId/cost-surface/shapefile',
})
@ApiConsumesShapefile({ withGeoJsonResponse: false })
@GeometryFileInterceptor(GeometryKind.ComplexWithProperties)
@ApiTags(asyncJobTag)
@Post(`:scenarioId/cost-surface/shapefile`)
async processCostSurfaceShapefile(
@Param('scenarioId') scenarioId: string,
@Req() req: RequestWithAuthenticatedUser,
@UploadedFile() file: Express.Multer.File,
): Promise<JsonApiAsyncJobMeta> {
await ensureShapefileHasRequiredFiles(file);

const result = await this.service.processCostSurfaceShapefile(
scenarioId,
req.user.id,
file,
);

if (isLeft(result)) {
throw mapAclDomainToHttpError(result.left, {
scenarioId,
userId: req.user.id,
resourceType: scenarioResource.name.plural,
});
}
return AsyncJobDto.forScenario().asJsonApiMetadata();
}

@ApiOperation({
description:
'Links a Cost Surface to a Scenario, and applies costs on the Geoprocessing DB',
Expand Down Expand Up @@ -497,28 +465,6 @@ export class ScenariosController {
return AsyncJobDto.forScenario().asJsonApiMetadata();
}

@ApiOperation({
deprecated: true,
description:
'To be removed soon to GET /projects/:projectId/cost-surface/:costSurfaceId/cost-range',
})
@Get(`:id/cost-surface`)
@ApiOkResponse({ type: CostRangeDto })
async getCostRange(
@Param('id') scenarioId: string,
@Req() req: RequestWithAuthenticatedUser,
): Promise<CostRangeDto> {
const result = await this.service.getCostRange(scenarioId, req.user.id);
if (isLeft(result)) {
throw mapAclDomainToHttpError(result.left, {
scenarioId,
userId: req.user.id,
resourceType: scenarioResource.name.plural,
});
}
return plainToClass<CostRangeDto, CostRangeDto>(CostRangeDto, result.right);
}

@ApiConsumesShapefile()
@ApiTags(inlineJobTag)
@Post(':id/planning-unit-shapefile')
Expand Down Expand Up @@ -1494,50 +1440,4 @@ export class ScenariosController {

return result.right;
}

@ApiConsumesShapefile({ withGeoJsonResponse: false })
@ApiOperation({
deprecated: true,
description:
'To be removed soon to POST /projects/:projectId/protected-areas/shapefile',
})
@GeometryFileInterceptor(GeometryKind.Complex)
@ApiTags(asyncJobTag)
@Post(':id/protected-areas/shapefile')
async shapefileForProtectedArea(
@Param('id') scenarioId: string,
@UploadedFile() file: Express.Multer.File,
@Req() req: RequestWithAuthenticatedUser,
@Body() dto: UploadShapefileDto,
): Promise<JsonApiAsyncJobMeta> {
const scenario = await this.service.getById(scenarioId, {
authenticatedUser: req.user,
});

if (isLeft(scenario)) {
throw mapAclDomainToHttpError(scenario.left, {
userId: req.user.id,
resourceType: scenarioResource.name.plural,
});
}

const outcome = await this.projectsService.addProtectedAreaFor(
scenario.right.projectId,
file,
{ authenticatedUser: req.user },
dto,
);

if (isLeft(outcome)) {
if (isLeft(outcome)) {
throw mapAclDomainToHttpError(outcome.left, {
scenarioId,
userId: req.user.id,
resourceType: scenarioResource.name.plural,
});
}
}

return AsyncJobDto.forProject().asJsonApiMetadata();
}
}

0 comments on commit 100f2ba

Please sign in to comment.