Skip to content

Commit

Permalink
Merge pull request #61 from 28th-meetup/feat/myStoreMenu
Browse files Browse the repository at this point in the history
feat: 내 가게의 메뉴 조회하기 api 기능 구현
  • Loading branch information
summit45 authored Nov 20, 2023
2 parents cec7061 + 7e42b07 commit 8334fae
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
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());
}
}

0 comments on commit 8334fae

Please sign in to comment.