From d39672d9530bf27f23f4ae7253aa51971d55ed14 Mon Sep 17 00:00:00 2001 From: koomchang Date: Sat, 9 Nov 2024 15:21:34 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=BD=94=EC=8A=A4=EC=97=90=20=EC=9E=A5?= =?UTF-8?q?=EC=86=8C=EB=A5=BC=20=EC=B6=94=EA=B0=80=ED=95=A0=20=EB=95=8C=20?= =?UTF-8?q?=EB=B3=B8=EC=9D=B8=EC=9D=B4=20=EB=A7=8C=EB=93=A0=20=EC=BD=94?= =?UTF-8?q?=EC=8A=A4=EC=9D=B8=EC=A7=80=20=ED=99=95=EC=9D=B8=20=ED=9B=84=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20=EA=B0=80=EB=8A=A5=ED=95=98=EB=8F=84?= =?UTF-8?q?=EB=A1=9D=20=EA=B5=AC=ED=98=84=20#83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/src/course/course.controller.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/backend/src/course/course.controller.ts b/backend/src/course/course.controller.ts index 171595e2..f9532984 100644 --- a/backend/src/course/course.controller.ts +++ b/backend/src/course/course.controller.ts @@ -16,6 +16,7 @@ import { CourseService } from './course.service'; import { SetPlacesOfCourseRequest } from './dto/AddPlaceToCourseRequest'; import { JwtAuthGuard } from '../auth/JwtAuthGuard'; import { AuthUser } from '../auth/AuthUser.decorator'; +import { CoursePermissionGuard } from './guards/CoursePermissionGuard'; @Controller('/courses') export class CourseController { @@ -46,13 +47,19 @@ export class CourseController { } @Post() - async createCourse(@Body() createCourseRequest: CreateCourseRequest) { - const userId = 1; // Todo. 로그인 기능 완성 후 수정 + @UseGuards(JwtAuthGuard) + async createCourse( + @AuthUser() user: AuthUser, + @Body() createCourseRequest: CreateCourseRequest, + ) { + const userId = Number(user.userId); return await this.courseService.createCourse(userId, createCourseRequest); } @Put('/:id/places') + @UseGuards(JwtAuthGuard, CoursePermissionGuard) async setPlacesOfCourse( + @AuthUser() user: AuthUser, @Param('id') id: number, @Body() setPlacesOfCourseRequest: SetPlacesOfCourseRequest, ) {