-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[2단계 - 주문 기능 구현] 디노(신종화) 미션 제출합니다. #53
Changes from 76 commits
586bb8b
4770a82
e3b3e2b
38d1233
869d34b
146bb31
53841ec
ad5fc3c
e91df10
2ea9348
87e8ba3
86b6137
2d74bfd
06c5e73
9bc7070
c14dd45
f3ea536
2f3117d
9ee6cfb
2d59f1f
3063f4e
9741e71
31e8334
32a95b0
bab3071
257bfeb
e105112
8c9e76d
eb8db15
2503e08
f53506f
beb6cb7
705e8a8
aaf12eb
d9d1c1e
51853a3
14538a7
3a38950
c95e406
69ed3ad
0de71a2
573b60b
6f3bf45
6a0d775
3e96997
5e7bf81
21dbe81
9dc54e2
4e80e2e
2abd4f3
c27e542
204abfa
464f67a
391f3d9
411f819
3d5a980
7168e54
1e3a2d4
0825fb8
aadc4ab
bbef94b
9791edf
6473e9a
0e607ee
d8fc26f
9129ff9
6afafce
6d484e8
5406b1d
29eca71
1398455
33b024d
b5e66f6
578ec44
121e581
424fb5b
6fb696e
cc8e9d5
c3c0e67
07c3532
7e1f7f5
1cd781c
41bac49
9772c36
89b89ac
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,3 +35,7 @@ out/ | |
|
||
### VS Code ### | ||
.vscode/ | ||
|
||
!**/src/main/resources/application.properties | ||
|
||
application.properties | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
넵~ 하셔도 됩니다 🙂 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,56 @@ | ||
# jwp-shopping-order | ||
|
||
## 기능 요구 사항 | ||
|
||
## 할인 정책 : 쿠폰, 포인트 | ||
|
||
### 주문 | ||
|
||
- [x] 장바구니에 담긴 상품만 주문이 가능하다. | ||
- [x] 주문할 품목, 사용할 쿠폰, 사용할 포인트를 요청으로 받는다. | ||
- [x] 주문 시 사용한 쿠폰 목록을 저장한다. | ||
- [x] 주문 시 사용한 쿠폰은 사용처리 한다. | ||
- [x] 주문 시 주문한 장바구니 품목은 장바구니에서 삭제한다. | ||
- [x] 주문 시 사용한 포인트와 적립된 포인트를 포인트 이력에 저장한다. | ||
|
||
|
||
### 쿠폰 | ||
|
||
- [x] 쿠폰은 정률 할인, 정액 할인 2종류가 존재한다. | ||
- [x] 동시에 여러 쿠폰을 적용할 때에는 정률 할인을 정액 할인보다 우선으로 두고 할인률이 더 높은 쿠폰을 우선으로 적용한다. | ||
- [x] 최소 주문 금액을 충족해야 쿠폰 적용이 가능하다. | ||
- [x] 사용자가 사용할 수 있는 쿠폰 목록을 반환한다. | ||
|
||
|
||
### 포인트 | ||
|
||
- [x] 현재 사용자의 잔여 포인트를 반환한다. | ||
- [x] 포인트는 결제 금액을 초과하여 사용할 수 없다. | ||
- [x] 포인트는 결제 금액의 1% 씩 적립된다. | ||
- [x] 포인트는 쿠폰 적용 후 남은 금액에 적용된다. | ||
|
||
## 기능 목록 | ||
- product | ||
- [x] 새로운 상품을 생성한다. | ||
- [x] 전체 상품 목록을 반환한다. | ||
- [x] 특정 상품 정보를 반환한다. | ||
- [x] 특정 상품 정보를 수정한다. | ||
- [x] 특정 상품을 삭제한다. | ||
|
||
- coupon | ||
- [x] 특정 사용자가 가지고 있는 쿠폰 목록을 조회한다. | ||
|
||
- point | ||
- [x] 특정 사용자가 보유한 포인트를 반환한다. | ||
|
||
- cart-item | ||
- [x] 사용자의 장바구니에 물건을 추가한다. | ||
- [x] 해당 사용자의 장바구니 목록을 반환한다. | ||
|
||
- order | ||
- [x] 사용자의 장바구니 목록 중 선택한 물건을 주문한다. | ||
- [x] 사용자의 주문 목록을 조회한다. | ||
- [x] 특정 주문의 상세 정보를 조회한다. | ||
|
||
|
||
[API 명세 Swagger 페이지 바로가기](https://zlzon-dino.store/swagger-ui/index.html#/) |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 적어둘 곳이 없어서 여기에 적습니다 🙇 README.md에 기능 구현 목록 혹은 주문 기능의 시나리오가 있어야할 것 같아요. (재화에 관련된 요구사항이 크루마다 달라서 더더욱 자세히 적어야 좋을 것 같습니다. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. README 작성이 가장 기본인데.. 깜빡했습니다ㅜㅜ 바로 올리겠습니다! |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. WebMvcConfig도 config라는 패키지를 만들어서 구분해주면 좋을 것 같습니다. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. config 패키지를 만들어 CorsConfig와 WebMvcConfig을 위치했습니다! 07c3532 |
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package cart.application.repository; | ||
|
||
import cart.domain.cartitem.CartItem; | ||
import cart.domain.cartitem.CartItems; | ||
|
||
import java.util.Optional; | ||
|
||
public interface CartItemRepository { | ||
Long createCartItem(CartItem cartItem); | ||
|
||
CartItems findAllCartItemsByMemberId(Long memberId); | ||
|
||
Optional<CartItem> findById(Long id); | ||
|
||
void deleteById(Long id); | ||
|
||
void updateQuantity(CartItem cartItem); | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package cart.application.repository; | ||
|
||
import cart.domain.coupon.Coupon; | ||
import cart.domain.discountpolicy.CouponPolicy; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
public interface CouponRepository { | ||
|
||
Coupon findById(final Long id); | ||
|
||
List<Coupon> findByMemberId(final Long memberId); | ||
|
||
List<Coupon> findAllByOrderId(final Long orderId); | ||
|
||
Optional<CouponPolicy> findPercentCouponById(final Long memberCouponId); | ||
|
||
Optional<CouponPolicy> findAmountCouponById(final Long memberCouponId); | ||
|
||
void convertToUseMemberCoupon(final Long memberCouponId); | ||
|
||
long createOrderedCoupon(final Long orderId, final Long memberCouponId); | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package cart.application.repository; | ||
|
||
import cart.domain.Member; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
public interface MemberRepository { | ||
|
||
Long createMember(Member member); | ||
|
||
List<Member> findAllMembers(); | ||
|
||
Optional<Member> findMemberById(Long id); | ||
|
||
Optional<Member> findMemberByEmail(final String email); | ||
|
||
Boolean isMemberExist(String email, String password); | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package cart.application.repository; | ||
|
||
import cart.domain.Point; | ||
import cart.domain.PointHistory; | ||
|
||
public interface PointRepository { | ||
|
||
Point findPointByMemberId(Long memberId); | ||
|
||
Long createPointHistory(final Long memberId, final PointHistory pointHistory); | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package cart.application.repository; | ||
|
||
import cart.domain.Product; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
public interface ProductRepository { | ||
|
||
Long createProduct(final Product product); | ||
|
||
List<Product> findAll(); | ||
|
||
Optional<Product> findById(final Long productId); | ||
|
||
void updateProduct(final Product product); | ||
|
||
void deleteProduct(final Long productId); | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package cart.application.repository.order; | ||
|
||
import cart.domain.order.Order; | ||
|
||
import java.util.List; | ||
|
||
public interface OrderRepository { | ||
|
||
Long createOrder(Order order); | ||
|
||
List<Order> findAllByMemberId(Long memberId); | ||
|
||
Order findById(Long memberid, Long id); | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package cart.application.repository.order; | ||
|
||
import cart.domain.order.OrderItem; | ||
|
||
import java.util.List; | ||
|
||
public interface OrderedItemRepository { | ||
|
||
void createOrderItems(final Long orderId, final List<OrderItem> orderItems); | ||
|
||
List<OrderItem> findOrderItemsByOrderId(final Long orderId); | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package cart.application.service.cartitem; | ||
|
||
import cart.application.repository.CartItemRepository; | ||
import cart.application.repository.MemberRepository; | ||
import cart.application.service.cartitem.dto.CartResultDto; | ||
import cart.domain.Member; | ||
import cart.domain.cartitem.CartItems; | ||
import cart.ui.MemberAuth; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
import java.util.NoSuchElementException; | ||
|
||
@Service | ||
@Transactional(readOnly = true) | ||
public class CartItemReadService { | ||
|
||
private final CartItemRepository cartItemRepository; | ||
private final MemberRepository memberRepository; | ||
|
||
public CartItemReadService(CartItemRepository cartItemRepository, final MemberRepository memberRepository) { | ||
this.cartItemRepository = cartItemRepository; | ||
this.memberRepository = memberRepository; | ||
} | ||
|
||
public CartResultDto findByMember(final MemberAuth memberAuth) { | ||
final Member member = memberRepository.findMemberById(memberAuth.getId()) | ||
.orElseThrow(() -> new NoSuchElementException("일치하는 사용자가 없습니다.")); | ||
|
||
final CartItems cartItems = cartItemRepository.findAllCartItemsByMemberId(member.getId()); | ||
final int totalPrice = cartItems.calculateTotalPrice(); | ||
|
||
return CartResultDto.of(cartItems.getCartItems(), totalPrice); | ||
} | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
네네 실제 AWS에서는 다른 프로퍼티 파일을 사용하고 있습니다.
db 아이디와 패스워드 등의 보안 정보가 노출되기 때문에
프로퍼티는 무조건 gitIgnore 해야 한다!
라는 생각을 가지고 있었던 것 같습니다.생각해 보니 db 설정에 대한 정보는 aws 서버에 따로 저장되어 있고, 현재 진행중인 프로젝트 패키지에서는 별다른 정보가 없어 그대로 push 해도 되겠군요..!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
테스트는 로컬에서도 정상적으로 돌아가야합니다! test패키지의 프로퍼티는 넣어주시면 좋을 것 같아요.
프로덕션 패키지의 application.properties도 local에서는 돌아갈 수 있게끔 설정해주시면 좋을 것 같습니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
마지막 커밋 사항을 올리지 않았네요..
적용했습니다..! 6fb696e