Skip to content
Open
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
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<name>wells-fargo-task-2</name>
<description>wells-fargo-task-2</description>
<properties>
<java.version>19</java.version>
<java.version>17</java.version>
</properties>
<dependencies>
<dependency>
Expand Down
86 changes: 0 additions & 86 deletions src/main/java/com/wellsfargo/counselor/entity/Advisor.java

This file was deleted.

55 changes: 55 additions & 0 deletions src/main/java/com/wellsfargo/counselor/entity/Client.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package com.wellsfargo.counselor.entity;

import jakarta.persistence.*;

@Entity
public class Client {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long clientId;

private String name;
private String email;
private String phone;
private String createdAt;

@ManyToOne
@JoinColumn(name = "advisor_id")
private FinancialAdvisor advisor;

@OneToOne(mappedBy = "client")
private Portfolio portfolio;

public Client() {}

public Client(Long clientId, String name, String email, String phone, String createdAt) {
this.clientId = clientId;
this.name = name;
this.email = email;
this.phone = phone;
this.createdAt = createdAt;
}

// Getters & Setters
public Long getClientId() { return clientId; }
public void setClientId(Long clientId) { this.clientId = clientId; }

public String getName() { return name; }
public void setName(String name) { this.name = name; }

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 getCreatedAt() { return createdAt; }
public void setCreatedAt(String createdAt) { this.createdAt = createdAt; }

public FinancialAdvisor getAdvisor() { return advisor; }
public void setAdvisor(FinancialAdvisor advisor) { this.advisor = advisor; }

public Portfolio getPortfolio() { return portfolio; }
public void setPortfolio(Portfolio portfolio) { this.portfolio = portfolio; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package com.wellsfargo.counselor.entity;

import jakarta.persistence.*;
import java.util.List;

@Entity
public class FinancialAdvisor {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long advisorId;

private String name;
private String email;
private String phone;
private String createdAt;

@OneToMany(mappedBy = "advisor")
private List<Client> clients;

public FinancialAdvisor() {}

public FinancialAdvisor(Long advisorId, String name, String email, String phone, String createdAt) {
this.advisorId = advisorId;
this.name = name;
this.email = email;
this.phone = phone;
this.createdAt = createdAt;
}

// Getters & Setters
public Long getAdvisorId() { return advisorId; }
public void setAdvisorId(Long advisorId) { this.advisorId = advisorId; }

public String getName() { return name; }
public void setName(String name) { this.name = name; }

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 getCreatedAt() { return createdAt; }
public void setCreatedAt(String createdAt) { this.createdAt = createdAt; }

public List<Client> getClients() { return clients; }
public void setClients(List<Client> clients) { this.clients = clients; }
}
41 changes: 41 additions & 0 deletions src/main/java/com/wellsfargo/counselor/entity/Portfolio.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package com.wellsfargo.counselor.entity;

import jakarta.persistence.*;
import java.util.List;

@Entity
public class Portfolio {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long portfolioId;

private String createdAt;

@OneToOne
@JoinColumn(name = "client_id")
private Client client;

@OneToMany(mappedBy = "portfolio")
private List<Security> securities;

public Portfolio() {}

public Portfolio(Long portfolioId, String createdAt) {
this.portfolioId = portfolioId;
this.createdAt = createdAt;
}

// Getters & Setters
public Long getPortfolioId() { return portfolioId; }
public void setPortfolioId(Long portfolioId) { this.portfolioId = portfolioId; }

public String getCreatedAt() { return createdAt; }
public void setCreatedAt(String createdAt) { this.createdAt = createdAt; }

public Client getClient() { return client; }
public void setClient(Client client) { this.client = client; }

public List<Security> getSecurities() { return securities; }
public void setSecurities(List<Security> securities) { this.securities = securities; }
}
54 changes: 54 additions & 0 deletions src/main/java/com/wellsfargo/counselor/entity/Security.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package com.wellsfargo.counselor.entity;

import jakarta.persistence.*;

@Entity
public class Security {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long securityId;

private String name;
private String category;
private String purchaseDate;
private Double purchasePrice;
private Integer quantity;

@ManyToOne
@JoinColumn(name = "portfolio_id")
private Portfolio portfolio;

public Security() {}

public Security(Long securityId, String name, String category, String purchaseDate, Double purchasePrice, Integer quantity) {
this.securityId = securityId;
this.name = name;
this.category = category;
this.purchaseDate = purchaseDate;
this.purchasePrice = purchasePrice;
this.quantity = quantity;
}

// Getters & Setters
public Long getSecurityId() { return securityId; }
public void setSecurityId(Long securityId) { this.securityId = securityId; }

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 String getPurchaseDate() { return purchaseDate; }
public void setPurchaseDate(String purchaseDate) { this.purchaseDate = purchaseDate; }

public Double getPurchasePrice() { return purchasePrice; }
public void setPurchasePrice(Double purchasePrice) { this.purchasePrice = purchasePrice; }

public Integer getQuantity() { return quantity; }
public void setQuantity(Integer quantity) { this.quantity = quantity; }

public Portfolio getPortfolio() { return portfolio; }
public void setPortfolio(Portfolio portfolio) { this.portfolio = portfolio; }
}