Skip to content

Commit

Permalink
feat: 포킷 상세 조회 api (#77)
Browse files Browse the repository at this point in the history
  • Loading branch information
jimin3263 authored Aug 7, 2024
1 parent aa2fb8c commit 6b038a8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,16 @@ class CategoryController(
.wrapSlice()
.wrapOk()

@Operation(summary = "포킷 상세 조회 API")
@GetMapping("/{categoryId}")
fun getCategory(
@AuthenticationPrincipal user: PrincipalUser,
@PathVariable categoryId: Long,
): ResponseEntity<CategoryResponse> =
categoryUseCase.getCategory(user.id, categoryId)
.toResponse()
.wrapOk()

@Operation(summary = "포킷 수정 API")
@ErrorOperation(CategoryErrorCode::class)
@PatchMapping("/{categoryId}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ interface CategoryUseCase {
fun getTotalCount(userId: Long): Int
fun getAllCategoryImages(): List<CategoryImage>
fun getCategories(userId: Long, pageable: Pageable, filterUncategorized: Boolean): Slice<Category>
fun getCategory(userId: Long, categoryId: Long): Category
}
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ class CategoryService(
return SliceImpl(filteredCategories, pageable, categoriesSlice.hasNext())
}

override fun getCategory(userId: Long, categoryId: Long): Category =
categoryPort.loadCategoryOrThrow(categoryId, userId)

override fun getAllCategoryImages(): List<CategoryImage> =
categoryImagePort.loadAll()

Expand Down

0 comments on commit 6b038a8

Please sign in to comment.