diff --git a/src/main/java/com/wellsfargo/counselor/entity/Client.java b/src/main/java/com/wellsfargo/counselor/entity/Client.java new file mode 100644 index 00000000..7913c10b --- /dev/null +++ b/src/main/java/com/wellsfargo/counselor/entity/Client.java @@ -0,0 +1,102 @@ +package com.wellsfargo.counselor.entity; + +import jakarta.persistence.*; + +import java.util.List; + +@Entity +public class Client { + @Id + @GeneratedValue + private long client_id; + + @Column(nullable = false) + private String firstName; + + @Column(nullable = false) + private String lastName; + + @Column(nullable = false) + private String email; + + @Column(nullable = false) + private String phone; + + @Column(nullable = false) + private String address; + + @ManyToOne + @JoinColumn(name = "advisorId") + private Advisor advisor; + + @OneToMany(mappedBy = "client") + private List portifolios; + + public Client() { + } + + public Client(String firstName, String lastName, String email, String phone, String address, Advisor advisor) { + this.firstName = firstName; + this.lastName = lastName; + this.email = email; + this.phone = phone; + this.address = address; + this.advisor = advisor; + } + + public long getClient_id() { + return client_id; + } + + public void setClient_id(long client_id) { + this.client_id = client_id; + } + + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + public Advisor getAdvisor() { + return advisor; + } + + public void setAdvisor(Advisor advisor) { + this.advisor = advisor; + } +} diff --git a/src/main/java/com/wellsfargo/counselor/entity/Portifolio.java b/src/main/java/com/wellsfargo/counselor/entity/Portifolio.java new file mode 100644 index 00000000..99bf1b0a --- /dev/null +++ b/src/main/java/com/wellsfargo/counselor/entity/Portifolio.java @@ -0,0 +1,63 @@ +package com.wellsfargo.counselor.entity; + +import jakarta.persistence.*; + +import java.util.Date; +import java.util.List; + +@Entity +public class Portifolio { + @Id + @GeneratedValue + private Long portifolio_id; + + @Column(nullable = false) + private Date creationDate; + + @ManyToOne + @JoinColumn(name = "client_id") + private Client client; + + @OneToMany(mappedBy = "portifolio") + private List securities; + + public Portifolio() { + } + + public Portifolio(Client client, Date creationDate) { + this.client = client; + this.creationDate = creationDate; + } + + public Long getPortifolio_id() { + return portifolio_id; + } + + public void setPortifolio_id(Long portifolio_id) { + this.portifolio_id = portifolio_id; + } + + public Date getCreationDate() { + return creationDate; + } + + public void setCreationDate(Date creationDate) { + this.creationDate = creationDate; + } + + public Client getClient() { + return client; + } + + public void setClient(Client client) { + this.client = client; + } + + public List getSecurities() { + return securities; + } + + public void setSecurities(List securities) { + this.securities = securities; + } +} diff --git a/src/main/java/com/wellsfargo/counselor/entity/Security.java b/src/main/java/com/wellsfargo/counselor/entity/Security.java new file mode 100644 index 00000000..a763878c --- /dev/null +++ b/src/main/java/com/wellsfargo/counselor/entity/Security.java @@ -0,0 +1,100 @@ +package com.wellsfargo.counselor.entity; + +import jakarta.persistence.*; + +import java.math.BigDecimal; +import java.util.Date; + +@Entity +public class Security { + @Id + @GeneratedValue + private Long security_id; + + @Column(nullable = false) + private String name; + + @Column(nullable = false) + private String category; + + @Column(nullable = false) + private Date purchaseDate; + + @Column(nullable = false) + private BigDecimal purchasePrice; + + @Column(nullable = false) + private int quantity; + + @ManyToOne + @JoinColumn(name = "portifolio_id") + private Portifolio portifolio; + + public Security() { + } + + public Security(Portifolio portifolio, String name, String category, Date purchaseDate, BigDecimal purchasePrice, int quantity) { + this.name = name; + this.category = category; + this.purchaseDate = purchaseDate; + this.purchasePrice = purchasePrice; + this.quantity = quantity; + this.portifolio = portifolio; + } + + public Long getSecurity_id() { + return security_id; + } + + public void setSecurity_id(Long security_id) { + this.security_id = security_id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getCategory() { + return category; + } + + public void setCategory(String category) { + this.category = category; + } + + public Date getPurchaseDate() { + return purchaseDate; + } + + public void setPurchaseDate(Date purchaseDate) { + this.purchaseDate = purchaseDate; + } + + public BigDecimal getPurchasePrice() { + return purchasePrice; + } + + public void setPurchasePrice(BigDecimal purchasePrice) { + this.purchasePrice = purchasePrice; + } + + public int getQuantity() { + return quantity; + } + + public void setQuantity(int quantity) { + this.quantity = quantity; + } + + public Portifolio getPortifolio() { + return portifolio; + } + + public void setPortifolio(Portifolio portifolio) { + this.portifolio = portifolio; + } +}