-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: 상점 카테고리 순서 변경 api 추가 #1007
base: develop
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생하셨습니다!
리뷰 몇가지만 확인해주시면 될 것 같아요
.andExpect(jsonPath("$.total_page").value(2)) | ||
.andExpect(jsonPath("$.current_page").value(1)) | ||
.andExpect(jsonPath("$.categories.length()").value(10)); | ||
.andExpect(content().json(""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
R
일반음식점과 치킨의 순서를 바꾸어도 정상적으로 테스트가 완료되네요
json을 사용해서는 검증하기 어려울 것 같습니다
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
좋은 피드백 감사합니다.
@PutMapping("/admin/shops/{shopId}/menus/categories") | ||
public ResponseEntity<Void> modifyMenuCategory( | ||
@Parameter(in = PATH) @PathVariable("shopId") Integer shopId, | ||
@RequestBody @Valid AdminModifyMenuCategoryRequest adminModifyMenuCategoryRequest, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
C
Valid를 지운 이유가 있나요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
수정하다가 신경쓰지 못하고 있었네요 좋은 지적 감사합니다.
@@ -41,6 +41,9 @@ public class ShopCategory extends BaseEntity { | |||
@Column(name = "image_url") | |||
private String imageUrl; | |||
|
|||
@Column(name = "order_index", nullable = false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A
Valid 제약조건에 관한 내용도 추가해주면 좋을 것 같습니다
@@ -273,6 +270,26 @@ private void validateExistCategoryName(String name, Integer categoryId) { | |||
} | |||
} | |||
|
|||
@Transactional | |||
public void modifyShopCategoriesOrder(AdminModifyShopCategoriesOrderRequest adminModifyShopCategoriesOrderRequest) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
C
Set의 차집합 연산을 이용하면 코드가 더 깔끔해지지 않을까 싶어요
🔥 연관 이슈
🚀 작업 내용
💬 리뷰 중점사항
한번에 카테고리들을 조회하여 map으로 매핑하는 방식을 사용하였습니다. 중복된 id검증을 위해 매핑되는 것마다 remove를 진행하여 예외를 처리했습니다.
정렬 순서를 저장하는 필드에 유니크 제약 조건을 걸까 생각했지만, 유연하게 처리하고자 따로 걸지는 않았습니다.