Skip to content

Commit

Permalink
feat: 서비스 식별키, path로 가이드 조회 API
Browse files Browse the repository at this point in the history
  • Loading branch information
alsdl0629 committed Jun 11, 2024
1 parent 0bd7210 commit 2e3205a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@ class GuideController(
ApiResponse.ok(guideService.getAll(path))

@GetMapping("/{serviceId}")
fun getAll(@PathVariable serviceId: Long): ApiResponse<GetAllGuidesResponse> =
ApiResponse.ok(guideService.getAll(serviceId))
fun getAll(@PathVariable serviceId: Long, @RequestParam @NotBlank path: String): ApiResponse<GetAllGuidesResponse> =
ApiResponse.ok(guideService.getAll(serviceId, path))
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ import org.springframework.data.jpa.repository.JpaRepository
interface GuideJpaRepository : JpaRepository<Guide, Long> {
fun findAllByPath(path: String): List<Guide>

fun findAllByServiceId(serviceId: Long): List<Guide>
fun findAllByServiceIdAndPath(serviceId: Long, path: String): List<Guide>
}
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ class GuideService(
return GetAllGuidesResponse.from(guides)
}

fun getAll(serviceId: Long): GetAllGuidesResponse {
val guides = guideJpaRepository.findAllByServiceId(serviceId)
fun getAll(serviceId: Long, path: String): GetAllGuidesResponse {
val guides = guideJpaRepository.findAllByServiceIdAndPath(serviceId, path)
return GetAllGuidesResponse.from(guides)
}
}

0 comments on commit 2e3205a

Please sign in to comment.