Skip to content
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

Fix: 장바구니 충돌 순서 변경 #117

Merged
merged 2 commits into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/main/java/com/readyvery/readyverydemo/domain/CeoInfo.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package com.readyvery.readyverydemo.domain;

import static jakarta.persistence.FetchType.*;

import java.time.LocalDateTime;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
import jakarta.persistence.FetchType;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.OneToOne;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;
import lombok.AllArgsConstructor;
import lombok.Builder;
Expand Down Expand Up @@ -79,7 +79,8 @@ public class CeoInfo extends BaseTimeEntity {
private LocalDateTime lastLoginDate;

// 사장님 가게 연관관계 매핑
@OneToOne(mappedBy = "ceoInfo", fetch = LAZY)
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "store_idx")
private Store store;

}
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public class Coupon extends BaseTimeEntity {
@Version
private Long version;

@Builder.Default
@OneToMany(mappedBy = "coupon", fetch = FetchType.LAZY)
private List<Order> orders = new ArrayList<Order>();
}
8 changes: 2 additions & 6 deletions src/main/java/com/readyvery/readyverydemo/domain/Store.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,10 @@
import jakarta.persistence.Entity;
import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
import jakarta.persistence.FetchType;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.OneToMany;
import jakarta.persistence.OneToOne;
import jakarta.persistence.Table;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
Expand Down Expand Up @@ -77,9 +74,8 @@ public class Store extends BaseTimeEntity {
private Grade grade;

//가게 사장님 연관관계 매핑
@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "ceo_idx")
private CeoInfo ceoInfo;
@OneToMany(mappedBy = "store")
private List<CeoInfo> ceoInfos = new ArrayList<CeoInfo>();

//가게 메뉴 카테고리 연관관계 매핑
@OneToMany(mappedBy = "store", cascade = CascadeType.ALL)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ public CartAddRes addCart(CustomUserDetails userDetails, CartAddReq cartAddReq)
Cart cart = cartRepository.findByUserInfoAndIsDeletedFalseAndIsOrderedFalse(user)
.orElseGet(() -> makeCart(user, store, cartAddReq.getInout()));

verifyCart(cart, cartAddReq.getInout());
verifyItemsInCart(cart, store, cartAddReq.getInout());
verifyCart(cart, cartAddReq.getInout());
CartItem cartItem = makeCartItem(cart, foodie, cartAddReq.getCount());
List<CartOption> cartOptions = cartAddReq.getOptions().stream()
.map(option -> makeCartOption(cartItem, option))
Expand Down