Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add files via upload #81

Open
wants to merge 4 commits into
base: flow
Choose a base branch
from
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 README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Task 2 Starter Repo
Contains Everything you need to get started on task 2 of Forage's Wells Fargo software engineering program
completed the task
81 changes: 81 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,81 @@
package com.wellsfargo.counselor.entity;

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

@Entity
public class Client {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long clientId;

@Column(nullable = false)
private String firstName;

@Column(nullable = false)
private String lastName;

@Column(nullable = false)
private String phoneNumber;

@ManyToOne
@JoinColumn(name = "advisorID", nullable = false)
private Advisor advisor;

@OneToOne(mappedBy = "client", cascade = CascadeType.ALL)
private Portfolio portfolio;

public Client(String firstName, String lastName, String phoneNumber, Advisor advisor ){
this.firstName = firstName;
this.lastName = lastName;
this.phoneNumber = phoneNumber;
}

public Long getClientId() {
return clientId;
}

public void setClientId(Long clientId) {
this.clientId = clientId;
}

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 getPhoneNumber() {
return phoneNumber;
}

public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}

public Advisor getAdvisor() {
return advisor;
}

public void setAdvisor(Advisor advisor) {
this.advisor = advisor;
}

public Portfolio getPortfolio() {
return portfolio;
}

public void setPortfolio(Portfolio portfolio) {
this.portfolio = portfolio;
}
}
46 changes: 46 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,46 @@
package com.wellsfargo.counselor.entity;

import jakarta.persistence.*;

import java.util.List;
@Entity
public class Portfolio {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long portfolioId;

@OneToOne
@JoinColumn(name = "clientId", nullable = false)
private Client client;

@OneToMany(mappedBy = "portfolio", cascade = CascadeType.ALL)
private List<Security> securities;

public Portfolio(Client client){
this.client = client;
}

public Long getPortfolioId() {
return portfolioId;
}

public void setPortfolioId(Long portfolioId) {
this.portfolioId = portfolioId;
}

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;
}
}
88 changes: 88 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,88 @@
package com.wellsfargo.counselor.entity;

import jakarta.persistence.*;

import java.util.Date;
import java.util.List;
@Entity
public class Security {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long securityId;

@ManyToOne
@JoinColumn(name = "portfolioId", nullable = false)
private Portfolio portfolio;

@Column(nullable = false)
private String name;

@Column(nullable = false)
private String category;

@Column(nullable = false)
@Temporal(TemporalType.DATE)
private Date purchaseDate;

@Column(nullable = false)
private double purchasePrice;

@Column(nullable = false)
private int quantity;

public Security(Long securityId, Portfolio portfolio, String name, String category, Date purchaseDate, double purchasePrice, int quantity) {
this.portfolio = portfolio;
this.name = name;
this.category = category;
this.purchaseDate = purchaseDate;
this.purchasePrice = purchasePrice;
this.quantity = quantity;
}

public Long getSecurityId(){
return securityId;
}

public Portfolio getPortfolio(){
return portfolio;
}

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

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

public String getName(){
return name;
}
public String getCategory() {
return category;
}

public void setCategory(String category) {
this.category = category;
}

public Date getPurchaseDate() {
return purchaseDate;
}

public double getPurchasePrice() {
return purchasePrice;
}

public void setPurchasePrice(double purchasePrice) {
this.purchasePrice = purchasePrice;
}

public int getQuantity() {
return quantity;
}

public void setQuantity(int quantity) {
this.quantity = quantity;
}
}