Skip to content

Commit

Permalink
feat : 스토어 사이즈/맛 조회 api 구현 - #31
Browse files Browse the repository at this point in the history
  • Loading branch information
lreowy committed Jan 15, 2025
1 parent fce8cf4 commit 90470db
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,9 @@ public ResponseEntity<BaseResponse<?>> getAllDesign(@PathVariable("storeId") fin
@RequestHeader(required = false) final Long userId) {
return ApiResponseUtil.success(SuccessCode.OK, storeService.getStoreAllDesign(storeId, userId));
}

@GetMapping("/{storeId}/size")
public ResponseEntity<BaseResponse<?>> getSizeAndTaste(@PathVariable("storeId") final Long storeId) {
return ApiResponseUtil.success(SuccessCode.OK, storeService.getStoreSizeAndTaste(storeId));
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
package com.cakey.store.dto;

public class StoreAllSizeAndTasteRes {
}
import com.cakey.size.dto.SizeDto;
import java.util.List;

public record StoreAllSizeAndTasteRes(
List<SizeDto> sizeDtoList,
String taste
) {
public static StoreAllSizeAndTasteRes of(List<SizeDto> sizeDtoList, String taste) {
return new StoreAllSizeAndTasteRes(sizeDtoList, taste);
}
}
13 changes: 11 additions & 2 deletions cakey-api/src/main/java/com/cakey/store/service/StoreService.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
import com.cakey.cake.domain.Cake;
import com.cakey.cake.dto.CakeMainImageDto;
import com.cakey.cake.facade.CakeFacade;
import com.cakey.cake.repository.CakeRepository;
import com.cakey.cakelike.facade.CakeLikesFacade;
import com.cakey.cakelike.repository.CakeLikesRepository;
import com.cakey.common.exception.NotFoundException;
import com.cakey.size.domain.Size;
import com.cakey.size.dto.SizeDto;
import com.cakey.size.facade.SizeFacade;
import com.cakey.store.domain.Station;
import com.cakey.store.domain.Store;
import com.cakey.store.dto.*;
import com.cakey.store.facade.StoreFacade;
import lombok.RequiredArgsConstructor;
Expand All @@ -25,6 +27,7 @@ public class StoreService {
private final StoreFacade storeFacade;
private final CakeFacade cakeFacade;
private final CakeLikesFacade cakeLikesFacade;
private final SizeFacade sizeFacade;

public List<StoreCoordinate> getStoreCoordinateList(final Station station) {
final List<StoreCoordianteDto> storeCoordianteDtoList = storeFacade.findCoordinatesByStation(station);
Expand Down Expand Up @@ -173,4 +176,10 @@ public StoreDetailAllDesignRes getStoreAllDesign(final long storeId, final Long

return new StoreDetailAllDesignRes(designs);
}


public StoreAllSizeAndTasteRes getStoreSizeAndTaste(final long storeId) {
final List<SizeDto> sizeList = sizeFacade.findSizeAllByStoreIdAndOrderByPriceAsc(storeId);
return StoreAllSizeAndTasteRes.of(sizeList, storeFacade.findTaste(storeId).taste());
}
}

0 comments on commit 90470db

Please sign in to comment.