-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(#59): 단일상품조회 API 구현 * feat(#59): 주문시 상품정보를 가져오는 내부 API 정의 - 요청에서 삭제된 상품정보는 아예 넘어오지 않아서 없는 경우 not found exception * feat(#59): 상품엔티티에 필터링과 관련된 컬럼 추가 - 상품 조회시 필요한 필터링 요소로 브랜드이름, 메인컬러, 사이즈, 태그 추가 및 쿠폰여부 제거 - 태그로 "COUPON", "EXPRESS_DELIVERY", "FREE_SHIPPING", "DISCOUNT", "NEW", "1+1", "RECOMMEND"가 추가될 수 있음 - 상품 조회시 필요한 정렬 요소로 리뷰카운트, 세일즈카운트 속성 추가 나중에 리뷰추가나 주문시 해당 count 증가가 필요 - 엔티티 속성추가로 변동되는 모든 dto, mapper 요소를 함께 수정
- Loading branch information
Showing
12 changed files
with
205 additions
and
44 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
service/product/product_dto/src/main/java/com/sparta/product_dto/ProductDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.sparta.product_dto; | ||
|
||
import java.math.BigDecimal; | ||
import java.util.List; | ||
import java.util.UUID; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@NoArgsConstructor | ||
public class ProductDto { | ||
private UUID productId; | ||
private String productName; | ||
private BigDecimal originalPrice; | ||
private BigDecimal discountedPrice; | ||
private Double discountPercent; | ||
private int stock; | ||
private List<String> tags; | ||
|
||
@Builder | ||
private ProductDto( | ||
UUID productId, | ||
String productName, | ||
BigDecimal originalPrice, | ||
BigDecimal discountedPrice, | ||
Double discountPercent, | ||
int stock, | ||
List<String> tags, | ||
boolean isCoupon) { | ||
this.productId = productId; | ||
this.productName = productName; | ||
this.originalPrice = originalPrice; | ||
this.discountedPrice = discountedPrice; | ||
this.discountPercent = discountPercent; | ||
this.stock = stock; | ||
this.tags = tags; | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
service/product/product_dto/src/main/java/com/sparta/product_dto/ProductReadRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.sparta.product_dto; | ||
|
||
import java.util.List; | ||
|
||
public record ProductReadRequest(List<String> productIds) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
...r/src/main/java/com/sparta/product/presentation/controller/ProductInternalController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.sparta.product.presentation.controller; | ||
|
||
import com.sparta.product.application.ProductService; | ||
import com.sparta.product_dto.ProductDto; | ||
import com.sparta.product_dto.ProductReadRequest; | ||
import java.util.List; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/internal/products") | ||
public class ProductInternalController { | ||
private final ProductService productService; | ||
|
||
@GetMapping | ||
public List<ProductDto> getProductList(@RequestBody ProductReadRequest request) { | ||
return productService.getProductList(request.productIds()); | ||
} | ||
} |
Oops, something went wrong.