diff --git a/src/main/java/com/kusitms/jipbap/store/StoreController.java b/src/main/java/com/kusitms/jipbap/store/StoreController.java index 274c438..20ac9cc 100644 --- a/src/main/java/com/kusitms/jipbap/store/StoreController.java +++ b/src/main/java/com/kusitms/jipbap/store/StoreController.java @@ -43,6 +43,13 @@ public CommonResponse registerStore( return new CommonResponse<>(storeService.registerStore(authInfo.getEmail(), dto, image)); } + @Operation(summary = "내 가게 아이디 조회하기") + @GetMapping("/my-store-id") + @ResponseStatus(HttpStatus.OK) + public CommonResponse getMyStore(@Auth AuthInfo authInfo) { + return new CommonResponse<>(storeService.getMyStore(authInfo.getEmail())); + } + /** * 가게 검색 api - 페이지네이션 적용 * api의 복잡도와 성능을 희생하는 대신, 데이터 중복/삭제 현상을 감안함 @@ -130,4 +137,6 @@ public CommonResponse getStoreOrderHistoryByOrderStatu @PathVariable String orderStatus) { return new CommonResponse<>(orderService.getStoreOrderHistoryByOrderStatus(authInfo.getEmail(), orderStatus)); } + + } diff --git a/src/main/java/com/kusitms/jipbap/store/StoreService.java b/src/main/java/com/kusitms/jipbap/store/StoreService.java index 8312a6e..0457aa7 100644 --- a/src/main/java/com/kusitms/jipbap/store/StoreService.java +++ b/src/main/java/com/kusitms/jipbap/store/StoreService.java @@ -98,6 +98,21 @@ public RegisterStoreResponse registerStore(String email, RegisterStoreRequestDto ); } + public StoreDto getMyStore(String email){ + User user = userRepository.findByEmail(email).orElseThrow(()-> new UserNotFoundException("유저 정보가 존재하지 않습니다.")); + Store store = storeRepository.findByOwner(user).orElseThrow(()-> new StoreNotExistsException("가게 정보가 존재하지 않습니다.")); + + return new StoreDto( + store.getId(), + store.getName(), + store.getDescription(), + store.getKoreanYn(), + store.getAvgRate(), + store.getMinOrderAmount(), + new String[]{store.getImage(), store.getImage2(), store.getImage3()} + ); + } + @Transactional public Slice searchStoreList(String email, Pageable pageable, String keyword, String standard, String order, Long lastId) { User user = userRepository.findByEmail(email).orElseThrow(()-> new UserNotFoundException("유저 정보가 존재하지 않습니다."));