store category
This commit is contained in:
parent
c866b7606a
commit
0289976085
@ -98,6 +98,27 @@ public class StoreService implements StoreUseCase {
|
||||
public String getAllTags(Long storeId){
|
||||
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
|
||||
public List<StoreListResponse> getAllStores() {
|
||||
|
||||
|
||||
@ -33,6 +33,9 @@ public interface StoreUseCase {
|
||||
|
||||
List<StoreListResponse> getAllStores();
|
||||
|
||||
List<StoreListResponse> getCategoryStores(String category);
|
||||
|
||||
|
||||
String getAllTags(Long storeId);
|
||||
|
||||
/**
|
||||
|
||||
@ -79,6 +79,14 @@ public class StoreController {
|
||||
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")
|
||||
@Operation(summary = "매장 전체 리스트")
|
||||
public ResponseEntity<String> getStoreTags(@PathVariable Long storeId) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user