Skip to content

Commit

Permalink
fix: 지도/코스 공개 여부 타입 검증
Browse files Browse the repository at this point in the history
  • Loading branch information
Miensoap committed Nov 25, 2024
1 parent 9ee3c96 commit 642f657
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions backend/src/course/course.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
Put,
Query,
UseGuards,
BadRequestException,
} from '@nestjs/common';
import { CreateCourseRequest } from './dto/CreateCourseRequest';
import { UpdateCourseInfoRequest } from './dto/UpdateCourseInfoRequest';
Expand Down Expand Up @@ -83,6 +84,10 @@ export class CourseController {
@Param('id') id: number,
@Body('isPublic') isPublic: boolean,
) {
if (typeof isPublic !== 'boolean') {
throw new BadRequestException('공개 여부는 boolean 타입이어야 합니다.');
}

await this.courseService.updateCourseVisibility(id, isPublic);
return { id, isPublic };
}
Expand Down
5 changes: 5 additions & 0 deletions backend/src/map/map.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
Delete,
Param,
Patch,
BadRequestException,
} from '@nestjs/common';
import { MapService } from './map.service';
import { CreateMapRequest } from './dto/CreateMapRequest';
Expand Down Expand Up @@ -75,6 +76,10 @@ export class MapController {
@Param('id') id: number,
@Body('isPublic') isPublic: boolean,
) {
if (typeof isPublic !== 'boolean') {
throw new BadRequestException('공개 여부는 boolean 타입이어야 합니다.');
}

await this.mapService.updateMapVisibility(id, isPublic);
return { id, isPublic };
}
Expand Down

0 comments on commit 642f657

Please sign in to comment.