Skip to content
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 기능 구현 #61

Merged
merged 1 commit into from
Nov 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/main/java/com/kusitms/jipbap/store/StoreController.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,13 @@ public CommonResponse<List<FoodDetailByStoreResponse>> getAllMenuListByStoreId(@
return new CommonResponse<>(storeService.getAllMenuListByStoreId(storeId));
}

@Operation(summary = "내 가게의 모든 메뉴 가져오기")
@GetMapping("/menu")
@ResponseStatus(HttpStatus.OK)
public CommonResponse<List<FoodDetailByStoreResponse>> getMyStoreMenu(@Auth AuthInfo authInfo) {
return new CommonResponse<>(storeService.getMyStoreMenu(authInfo.getEmail()));
}

@Operation(summary = "가게의 주문내역에 맞는 주문 리스트 가져오기")
@GetMapping("order-history/{orderStatus}")
public CommonResponse<OwnerOrderStatusResponse> getStoreOrderHistoryByOrderStatus(
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/com/kusitms/jipbap/store/StoreService.java
Original file line number Diff line number Diff line change
Expand Up @@ -227,4 +227,10 @@ public List<FoodDetailByStoreResponse> getAllMenuListByStoreId(Long storeId) {
return foodDetailByStoreResponseList;
}

public List<FoodDetailByStoreResponse> getMyStoreMenu(String email){
User user = userRepository.findByEmail(email).orElseThrow(()-> new UserNotFoundException("유저 정보가 존재하지 않습니다."));
Store store = storeRepository.findByOwner(user).orElseThrow(()-> new StoreNotExistsException("가게 정보가 존재하지 않습니다."));

return getAllMenuListByStoreId(store.getId());
}
}
Loading