Skip to content

Commit

Permalink
Fix error handling for cost surface range service
Browse files Browse the repository at this point in the history
  • Loading branch information
yulia-bel committed Oct 3, 2023
1 parent 2a3dd30 commit d3e205c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions api/apps/api/src/modules/cost-surface/cost-surface.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { CostSurface } from '@marxan-api/modules/cost-surface/cost-surface.api.e
import { Repository } from 'typeorm';
import { ProjectAclService } from '@marxan-api/modules/access-control/projects-acl/project-acl.service';
import { Either, left, right } from 'fp-ts/lib/Either';
import { projectNotEditable } from '@marxan-api/modules/projects/projects.service';
import { projectNotEditable, projectNotVisible } from "@marxan-api/modules/projects/projects.service";
import { UploadCostSurfaceShapefileDto } from '@marxan-api/modules/cost-surface/dto/upload-cost-surface-shapefile.dto';
import { UpdateCostSurfaceDto } from '@marxan-api/modules/cost-surface/dto/update-cost-surface.dto';
import { CostSurfaceCalculationPort } from '@marxan-api/modules/cost-surface/ports/project/cost-surface-calculation.port';
Expand Down Expand Up @@ -145,17 +145,17 @@ export class CostSurfaceService {
userId: string,
): Promise<
Either<
typeof costSurfaceNotFoundForProject | typeof projectNotEditable,
typeof costSurfaceNotFoundForProject | typeof projectNotVisible,
CostRange
>
> {
if (
!(await this.projectAclService.canEditCostSurfaceInProject(
!(await this.projectAclService.canViewProject(
userId,
projectId,
))
) {
return left(projectNotEditable);
return left(projectNotVisible);
}
const costRange = await this.costSurfaceRepository.findOne({
select: ['min', 'max'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export class ProjectCostSurfaceController {
@UseGuards(JwtAuthGuard)
@ApiParam({
name: 'costSurfaceId',
description: 'The id of the Cost Surface to be updated',
description: 'The id of the Cost Surface for which to retrieve [min,max] cost range',
})
@ApiParam({
name: 'projectId',
Expand Down

0 comments on commit d3e205c

Please sign in to comment.