Skip to content

Commit

Permalink
chore: remove InventoryLocation
Browse files Browse the repository at this point in the history
  • Loading branch information
lcaohoanq committed Dec 10, 2024
1 parent 29c7f5b commit 668cd65
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
@NoArgsConstructor
@AllArgsConstructor
@MappedSuperclass
public class BaseLocation {
public class BaseLocation extends BaseEntity {

private String name;
private String address;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.fasterxml.jackson.annotation.JsonManagedReference;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.lcaohoanq.shoppe.base.entity.BaseEntity;
import com.lcaohoanq.shoppe.base.entity.BaseLocation;
import com.lcaohoanq.shoppe.domain.product.Product;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
Expand All @@ -28,7 +29,7 @@
@AllArgsConstructor
@Table(name = "inventories")
@Entity
public class Inventory extends BaseEntity {
public class Inventory extends BaseLocation {

@Id
@SequenceGenerator(name = "inventories_seq", sequenceName = "inventories_id_seq", allocationSize = 1)
Expand All @@ -37,11 +38,6 @@ public class Inventory extends BaseEntity {
@JsonProperty("id")
private Long id;

@JsonManagedReference
@OneToMany(mappedBy = "inventory")
@JsonProperty("inventory_locations")
private Set<InventoryLocation> inventoryLocations;

@OneToMany(mappedBy = "inventory")
@JsonManagedReference
private Set<Product> products;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.lcaohoanq.shoppe.domain.inventory;


import com.fasterxml.jackson.annotation.JsonBackReference;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.lcaohoanq.shoppe.base.entity.BaseLocation;
import jakarta.persistence.Column;
Expand All @@ -19,25 +17,24 @@
import lombok.NoArgsConstructor;
import lombok.Setter;

@Entity
@Table(name = "sub_inventories")
@Builder
@Getter
@Setter
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "inventory_locations")
@Entity
public class InventoryLocation extends BaseLocation {
public class SubInventory extends BaseLocation {

@Id
@SequenceGenerator(name = "inventory_locations_seq", sequenceName = "inventory_locations_id_seq", allocationSize = 1)
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "inventory_locations_seq")
@SequenceGenerator(name = "sub_inventories_seq", sequenceName = "sub_inventories_id_seq", allocationSize = 1)
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sub_inventories_seq")
@Column(name="id", unique=true, nullable=false)
@JsonProperty("id")
private Long id;

@ManyToOne
@JsonBackReference
@JoinColumn(name = "inventory_id", nullable = false)
@JoinColumn(name = "inventory_id")
private Inventory inventory;

}

0 comments on commit 668cd65

Please sign in to comment.