store category

This commit is contained in:
youbeen 2025-06-19 14:55:22 +09:00
parent c866b7606a
commit 0289976085
3 changed files with 32 additions and 0 deletions

View File

@ -98,6 +98,27 @@ public class StoreService implements StoreUseCase {
public String getAllTags(Long storeId){ public String getAllTags(Long storeId){
return storeJpaRepository.findById(storeId).get().getTagsJson(); return storeJpaRepository.findById(storeId).get().getTagsJson();
} }
@Override
public List<StoreListResponse> getCategoryStores(String category){
List<StoreEntity> stores = storeJpaRepository.findByCategory(category);
return stores.stream()
.map(store -> StoreListResponse.builder()
.storeId(store.getId())
.storeName(store.getStoreName())
.address(store.getAddress())
.category(store.getCategory())
.rating(store.getRating())
.reviewCount(store.getReviewCount())
.status("운영중")
.tagJson(store.getTagsJson())
.imageUrl(store.getImageUrl())
.operatingHours(store.getOperatingHours())
.build())
.collect(Collectors.toList());
}
@Override @Override
public List<StoreListResponse> getAllStores() { public List<StoreListResponse> getAllStores() {

View File

@ -33,6 +33,9 @@ public interface StoreUseCase {
List<StoreListResponse> getAllStores(); List<StoreListResponse> getAllStores();
List<StoreListResponse> getCategoryStores(String category);
String getAllTags(Long storeId); String getAllTags(Long storeId);
/** /**

View File

@ -79,6 +79,14 @@ public class StoreController {
return ResponseEntity.ok(ApiResponse.success(responses)); return ResponseEntity.ok(ApiResponse.success(responses));
} }
@GetMapping("/stores/category/{category}")
@Operation(summary = "카테고리에 해당하는 매장")
public ResponseEntity<ApiResponse<List<StoreListResponse>>> getStoreCategories(@PathVariable String category) {
List<StoreListResponse> responses = storeUseCase.getCategoryStores(category);
return ResponseEntity.ok(ApiResponse.success(responses));
}
@GetMapping("/stores/{storeId}/tags") @GetMapping("/stores/{storeId}/tags")
@Operation(summary = "매장 전체 리스트") @Operation(summary = "매장 전체 리스트")
public ResponseEntity<String> getStoreTags(@PathVariable Long storeId) { public ResponseEntity<String> getStoreTags(@PathVariable Long storeId) {