diff --git a/2Week_Mission/mutbooks/src/main/java/com/example/mutbooks/app/base/initData/DevInitData.java b/2Week_Mission/mutbooks/src/main/java/com/example/mutbooks/app/base/initData/DevInitData.java index 066d79f..6aa7d78 100644 --- a/2Week_Mission/mutbooks/src/main/java/com/example/mutbooks/app/base/initData/DevInitData.java +++ b/2Week_Mission/mutbooks/src/main/java/com/example/mutbooks/app/base/initData/DevInitData.java @@ -2,6 +2,7 @@ import com.example.mutbooks.app.cart.service.CartService; import com.example.mutbooks.app.member.service.MemberService; +import com.example.mutbooks.app.order.service.OrderService; import com.example.mutbooks.app.post.service.PostService; import com.example.mutbooks.app.product.service.ProductService; import org.springframework.boot.CommandLineRunner; @@ -17,10 +18,11 @@ CommandLineRunner initData( MemberService memberService, PostService postService, ProductService productService, - CartService cartService + CartService cartService, + OrderService orderService ) { return args -> { - before(memberService, postService, productService, cartService); + before(memberService, postService, productService, cartService, orderService); }; } } \ No newline at end of file diff --git a/2Week_Mission/mutbooks/src/main/java/com/example/mutbooks/app/base/initData/InitDataBefore.java b/2Week_Mission/mutbooks/src/main/java/com/example/mutbooks/app/base/initData/InitDataBefore.java index 7ad7473..fbbbc6f 100644 --- a/2Week_Mission/mutbooks/src/main/java/com/example/mutbooks/app/base/initData/InitDataBefore.java +++ b/2Week_Mission/mutbooks/src/main/java/com/example/mutbooks/app/base/initData/InitDataBefore.java @@ -4,6 +4,7 @@ import com.example.mutbooks.app.member.entity.Member; import com.example.mutbooks.app.member.form.JoinForm; import com.example.mutbooks.app.member.service.MemberService; +import com.example.mutbooks.app.order.service.OrderService; import com.example.mutbooks.app.post.form.WriteForm; import com.example.mutbooks.app.post.service.PostService; import com.example.mutbooks.app.product.entity.Product; @@ -11,7 +12,13 @@ import com.example.mutbooks.app.product.service.ProductService; public interface InitDataBefore { - default void before(MemberService memberService, PostService postService, ProductService productService, CartService cartService) { + default void before( + MemberService memberService, + PostService postService, + ProductService productService, + CartService cartService, + OrderService orderService + ) { // 1번 회원(작가) Member member1 = memberService.join(new JoinForm("user1", "1234", "딸기", "user1@test.com")); // 2번 회원(작가) @@ -39,11 +46,18 @@ default void before(MemberService memberService, PostService postService, Produc // 2번 회원이 2번(로맨스) 글 키워드 선택 -> 4, 5번 글 도서 등록(3번 도서) Product product3 = productService.create(member2, new ProductForm("하트모양 크래커", "로맨스 소설입니다.", 15000, 3L, "#로맨스 #소설")); - // 1번 회원이 3번 도서 장바구니 품목 추가 + // 1번 회원이 3번 도서 장바구니 품목 추가(1번 CartItem) cartService.addCartItem(member1, product3); - // 3번 회원이 1, 2번 도서 장바구니 품목 추가 + // 3번 회원이 1, 2, 3번 도서 장바구니 품목 추가(2, 3, 4번 CartItem) cartService.addCartItem(member3, product1); cartService.addCartItem(member3, product2); + cartService.addCartItem(member3, product3); + + // 1번 회원 1번 주문 생성 + orderService.createOrder(member1, "1"); + // 3번 회원 2, 3번 주문 생성 + orderService.createOrder(member3, "2,3"); + orderService.createOrder(member3, "4"); } } diff --git a/2Week_Mission/mutbooks/src/main/java/com/example/mutbooks/app/base/initData/TestInitData.java b/2Week_Mission/mutbooks/src/main/java/com/example/mutbooks/app/base/initData/TestInitData.java index 34b6abc..0542090 100644 --- a/2Week_Mission/mutbooks/src/main/java/com/example/mutbooks/app/base/initData/TestInitData.java +++ b/2Week_Mission/mutbooks/src/main/java/com/example/mutbooks/app/base/initData/TestInitData.java @@ -2,6 +2,7 @@ import com.example.mutbooks.app.cart.service.CartService; import com.example.mutbooks.app.member.service.MemberService; +import com.example.mutbooks.app.order.service.OrderService; import com.example.mutbooks.app.post.service.PostService; import com.example.mutbooks.app.product.service.ProductService; import org.springframework.boot.CommandLineRunner; @@ -17,10 +18,11 @@ CommandLineRunner initData( MemberService memberService, PostService postService, ProductService productService, - CartService cartService + CartService cartService, + OrderService orderService ) { return args -> { - before(memberService, postService, productService, cartService); + before(memberService, postService, productService, cartService, orderService); }; } } \ No newline at end of file