From 72a993e7c67f567c70ff83f5d4274afbfe4c4fbd Mon Sep 17 00:00:00 2001 From: safaeRabbouzi <safae.rabbouzi@marketingconfort.com> Date: Tue, 3 Sep 2024 15:15:26 +0100 Subject: [PATCH 1/3] add new attribute in itemCart model --- CHANGELOG.md | 2 +- .../mydressin/common/cart/models/ItemCart.java | 6 +++++- .../mydressin/common/cart/models/UnregisteredCart.java | 10 +++++----- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3cc157d..294a76b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ ## [1.0.71-RELEASE] ### Added -- New features that have been added. +- MYD-user-3: add new attribute in itemCart model ### Changed - Changes in existing functionality. diff --git a/src/main/java/com/marketingconfort/mydressin/common/cart/models/ItemCart.java b/src/main/java/com/marketingconfort/mydressin/common/cart/models/ItemCart.java index 0eaf914..6defd90 100644 --- a/src/main/java/com/marketingconfort/mydressin/common/cart/models/ItemCart.java +++ b/src/main/java/com/marketingconfort/mydressin/common/cart/models/ItemCart.java @@ -55,9 +55,13 @@ public class ItemCart { private ItemCartStatus status; @ManyToOne - @JoinColumn(name = "cart_id", nullable = false) + @JoinColumn(name = "cart_id", nullable = true) private Cart cart; + @ManyToOne + @JoinColumn(name = "Unregistered_cart_id", nullable = true) + private UnregisteredCart unregisteredCart; + @OneToOne(mappedBy = "itemCart", cascade = CascadeType.ALL) private SessionOrder order; diff --git a/src/main/java/com/marketingconfort/mydressin/common/cart/models/UnregisteredCart.java b/src/main/java/com/marketingconfort/mydressin/common/cart/models/UnregisteredCart.java index 5e6cb59..2c91ab3 100644 --- a/src/main/java/com/marketingconfort/mydressin/common/cart/models/UnregisteredCart.java +++ b/src/main/java/com/marketingconfort/mydressin/common/cart/models/UnregisteredCart.java @@ -26,8 +26,8 @@ public class UnregisteredCart { @Column(name = "items_count", nullable = false) private long itemsCount; - @Column(name = "client_id") - private Long clientId; + @Column(name = "unregistered_client_id") + private Long unregisteredClientId; @Transient private double totalPrice; @@ -49,18 +49,18 @@ public class UnregisteredCart { private LocalDateTime lastModification; @ElementCollection - @CollectionTable(name = "cart_promocodes", joinColumns = @JoinColumn(name = "cart_id")) + @CollectionTable(name = "cart_promocodes", joinColumns = @JoinColumn(name = "Unregistered_cart_id")) @Column(name = "promocode_id") private List<Long> promoCodeIds; @ElementCollection - @CollectionTable(name = "cart_giftcards", joinColumns = @JoinColumn(name = "cart_id")) + @CollectionTable(name = "cart_giftcards", joinColumns = @JoinColumn(name = "Unregistered_cart_id")) @Column(name = "giftcard_id") private List<Long> giftCardIds; @Transient private List<PromoCodeDTO> promoCodes; - @OneToMany(mappedBy = "cart", cascade = CascadeType.ALL, orphanRemoval = true) + @OneToMany(mappedBy = "unregisteredCart", cascade = CascadeType.ALL, orphanRemoval = true) private List<ItemCart> items; } -- GitLab From f151773c0a8e9da3b2dc0973d1c01c0ae7e7d8d3 Mon Sep 17 00:00:00 2001 From: safaeRabbouzi <safae.rabbouzi@marketingconfort.com> Date: Tue, 3 Sep 2024 15:15:26 +0100 Subject: [PATCH 2/3] add new attribute in itemCart model --- CHANGELOG.md | 2 +- .../mydressin/common/cart/models/ItemCart.java | 6 +++++- .../mydressin/common/cart/models/UnregisteredCart.java | 10 +++++----- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1569ca8..de25083 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,7 +18,7 @@ - Any security improvements. ## [1.0.71-RELEASE] ### Added -- New features that have been added. +- MYD-user-3: add new attribute in itemCart model ### Changed - Changes in existing functionality. diff --git a/src/main/java/com/marketingconfort/mydressin/common/cart/models/ItemCart.java b/src/main/java/com/marketingconfort/mydressin/common/cart/models/ItemCart.java index 0eaf914..6defd90 100644 --- a/src/main/java/com/marketingconfort/mydressin/common/cart/models/ItemCart.java +++ b/src/main/java/com/marketingconfort/mydressin/common/cart/models/ItemCart.java @@ -55,9 +55,13 @@ public class ItemCart { private ItemCartStatus status; @ManyToOne - @JoinColumn(name = "cart_id", nullable = false) + @JoinColumn(name = "cart_id", nullable = true) private Cart cart; + @ManyToOne + @JoinColumn(name = "Unregistered_cart_id", nullable = true) + private UnregisteredCart unregisteredCart; + @OneToOne(mappedBy = "itemCart", cascade = CascadeType.ALL) private SessionOrder order; diff --git a/src/main/java/com/marketingconfort/mydressin/common/cart/models/UnregisteredCart.java b/src/main/java/com/marketingconfort/mydressin/common/cart/models/UnregisteredCart.java index 5e6cb59..2c91ab3 100644 --- a/src/main/java/com/marketingconfort/mydressin/common/cart/models/UnregisteredCart.java +++ b/src/main/java/com/marketingconfort/mydressin/common/cart/models/UnregisteredCart.java @@ -26,8 +26,8 @@ public class UnregisteredCart { @Column(name = "items_count", nullable = false) private long itemsCount; - @Column(name = "client_id") - private Long clientId; + @Column(name = "unregistered_client_id") + private Long unregisteredClientId; @Transient private double totalPrice; @@ -49,18 +49,18 @@ public class UnregisteredCart { private LocalDateTime lastModification; @ElementCollection - @CollectionTable(name = "cart_promocodes", joinColumns = @JoinColumn(name = "cart_id")) + @CollectionTable(name = "cart_promocodes", joinColumns = @JoinColumn(name = "Unregistered_cart_id")) @Column(name = "promocode_id") private List<Long> promoCodeIds; @ElementCollection - @CollectionTable(name = "cart_giftcards", joinColumns = @JoinColumn(name = "cart_id")) + @CollectionTable(name = "cart_giftcards", joinColumns = @JoinColumn(name = "Unregistered_cart_id")) @Column(name = "giftcard_id") private List<Long> giftCardIds; @Transient private List<PromoCodeDTO> promoCodes; - @OneToMany(mappedBy = "cart", cascade = CascadeType.ALL, orphanRemoval = true) + @OneToMany(mappedBy = "unregisteredCart", cascade = CascadeType.ALL, orphanRemoval = true) private List<ItemCart> items; } -- GitLab From 014c12f9f719963f6e7f08599335ca97c2fe0ac2 Mon Sep 17 00:00:00 2001 From: safaeRabbouzi <safae.rabbouzi@marketingconfort.com> Date: Tue, 3 Sep 2024 18:03:53 +0100 Subject: [PATCH 3/3] add new attribute in itemCart model --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index de25083..7fd1936 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ ## [1.0.72-RELEASE] ### Added -- New features that have been added. +- MYD-user-3: add new attribute in itemCart model ### Changed - Changes in existing functionality. -- GitLab