Skip to content

Commit

Permalink
테마 id로 단건 조회 api 추가 (#306)
Browse files Browse the repository at this point in the history
  • Loading branch information
asp345 authored Dec 20, 2024
1 parent 79b1739 commit ee70cbf
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
8 changes: 8 additions & 0 deletions api/src/main/kotlin/handler/TimetableThemeHandler.kt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ class TimetableThemeHandler(
ListResponse(result)
}

suspend fun getTheme(req: ServerRequest) =
handle(req) {
val userId = req.userId
val themeId = req.pathVariable("themeId")

TimetableThemeDto(timetableThemeService.getTheme(userId, themeId))
}

suspend fun addTheme(req: ServerRequest) =
handle(req) {
val userId = req.userId
Expand Down
1 change: 1 addition & 0 deletions api/src/main/kotlin/router/MainRouter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ class MainRouter(
GET("/best", timetableThemeHandler::getBestThemes)
GET("/friends", timetableThemeHandler::getFriendsThemes)
POST("", timetableThemeHandler::addTheme)
GET("/{themeId}", timetableThemeHandler::getTheme)
PATCH("/{themeId}", timetableThemeHandler::modifyTheme)
DELETE("/{themeId}", timetableThemeHandler::deleteTheme)
POST("/{themeId}/copy", timetableThemeHandler::copyTheme)
Expand Down
11 changes: 11 additions & 0 deletions api/src/main/kotlin/router/docs/ThemeDocs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,17 @@ import org.springframework.web.bind.annotation.RequestMethod
],
),
),
RouterOperation(
path = "/v1/themes/{themeId}",
method = [RequestMethod.GET],
produces = [MediaType.APPLICATION_JSON_VALUE],
operation =
Operation(
operationId = "getTheme",
parameters = [Parameter(`in` = ParameterIn.PATH, name = "themeId", required = true)],
responses = [ApiResponse(responseCode = "200", content = [Content(schema = Schema())])],
),
),
RouterOperation(
path = "/v1/themes/{themeId}",
method = [RequestMethod.PATCH],
Expand Down

0 comments on commit ee70cbf

Please sign in to comment.