Skip to content

Commit

Permalink
Merge pull request #91 from awesominat/removed-username-in-buy
Browse files Browse the repository at this point in the history
removed username mention in the project
  • Loading branch information
gursi26 committed Nov 24, 2023
2 parents ff09c53 + 21fd32e commit e8b4726
Show file tree
Hide file tree
Showing 13 changed files with 13 additions and 44 deletions.
2 changes: 1 addition & 1 deletion src/main/java/app/buySellTesting.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static void main(String[] args) throws IOException, InterruptedException
User newUser = new CommonUser();
userDataAccessObject.save();

BuyInputData buyInputData = new BuyInputData(10.0, "AAPL", "zain");
BuyInputData buyInputData = new BuyInputData(10.0, "AAPL");
BuyOutputBoundary buyPresenter = new BuyPresenter(new ViewManagerModel(), new BuyView(new BuyViewModel()));
SellOutputBoundary sellPresenter = new SellPresenter(new ViewManagerModel(), new SellViewModel(), new DashboardViewModel());
APIAccessInterface Finnhub = new Finnhub();
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/app/testSellView.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ public static void main(String[] args) throws IOException {

APIAccessInterface driverAPI = new Finnhub();

BuyInputData buyInputData = new BuyInputData(10.0, "AAPL", "zain");
BuyInputData buyInputData2 = new BuyInputData(10.0, "MSFT", "zain");
BuyInputData buyInputData = new BuyInputData(10.0, "AAPL");
BuyInputData buyInputData2 = new BuyInputData(10.0, "MSFT");
BuyViewModel buyViewModel = new BuyViewModel();
BuyView buyView = new BuyView(buyViewModel);
BuyOutputBoundary buyPresenter = new BuyPresenter(viewManagerModel, buyView);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/entities/CommonUserFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import java.util.HashMap;

public class CommonUserFactory implements UserFactory {
public User create(String username, String password) {
public User create() {
Double initialBalance = 1000.0;
HashMap<String, Double> initialPortfolio = new HashMap<>();
HashMap<String, TransactionHistory> history = new HashMap<String, TransactionHistory>();
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/entities/UserFactory.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package entities;

public interface UserFactory {
User create(String name, String password);
User create();
}
4 changes: 2 additions & 2 deletions src/main/java/interface_adapters/Buy/BuyController.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ public BuyController(BuyInputBoundary buyInteractor) {
this.buyInteractor = buyInteractor;
}

public void execute(Double amount, String ticker, String username) {
public void execute(Double amount, String ticker) {
// TODO Ricky
BuyInputData buyInputData = new BuyInputData(amount, ticker, username);
BuyInputData buyInputData = new BuyInputData(amount, ticker);
buyInteractor.execute(buyInputData);
}
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
package interface_adapters.ResetBalance;
import use_cases.ResetBalance.ResetBalanceInputBoundary;
import use_cases.ResetBalance.ResetBalanceInputData;
public class ResetBalanceController {
final private ResetBalanceInputBoundary resetBalanceInteractor;

public ResetBalanceController(ResetBalanceInputBoundary resetBalanceInteractor) {
this.resetBalanceInteractor = resetBalanceInteractor;
}

public void execute(String username) {
ResetBalanceInputData resetBalanceInputData = new ResetBalanceInputData(username);
resetBalanceInteractor.execute(resetBalanceInputData);
public void execute() {
resetBalanceInteractor.execute();
}
}
8 changes: 1 addition & 7 deletions src/main/java/use_cases/Buy/BuyInputData.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@
public class BuyInputData {
public Double amount;
public String ticker;
public String username;

public BuyInputData(Double amount, String ticker, String username) {
public BuyInputData(Double amount, String ticker) {
this.amount = amount;
this.ticker = ticker;
this.username = username;
}

public Double getAmount() {
Expand All @@ -18,8 +16,4 @@ public Double getAmount() {
public String getTicker() {
return ticker;
}

public String getUsername() {
return username;
}
}
1 change: 0 additions & 1 deletion src/main/java/use_cases/Buy/BuyInteractor.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ public BuyInteractor(BuyDataAccessInterface userDataAccessInterface,

@Override
public void execute(BuyInputData buyInputData) {
String username = buyInputData.getUsername();
String ticker = buyInputData.getTicker();
Double amount = buyInputData.getAmount();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package use_cases.ResetBalance;

public interface ResetBalanceInputBoundary {
void execute(ResetBalanceInputData resetBalanceInputData);
void execute();
}
13 changes: 0 additions & 13 deletions src/main/java/use_cases/ResetBalance/ResetBalanceInputData.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package use_cases.ResetBalance;

import entities.*;
import use_cases.ResetBalance.ResetBalanceOutputBoundary;
import use_cases.APIAccessInterface;
import use_cases.BaseStockInteractor;

Expand All @@ -21,9 +20,7 @@ public ResetBalanceInteractor(ResetBalanceDataAccessInterface userDataAccessInte
this.driverAPI = driverAPI;
}
@Override
public void execute(ResetBalanceInputData sellInputData) {
String username = sellInputData.getUsername();

public void execute() {
User user = userDataAccessObject.get();
Double curBalance = user.getBalance();
Double amountToAdd = 10000.0;
Expand Down
6 changes: 0 additions & 6 deletions src/main/java/view/BuyView.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,8 @@ public class BuyView extends JPanel implements ActionListener, PropertyChangeLis
public final String viewName = "buy";
private final BuyViewModel buyViewModel;

/**
* The username chosen by the user
*/
final JTextField amountInputField = new JTextField(15);
private final JLabel amountErrorField = new JLabel();
/**
* The password
*/
final JButton purchase;
final JButton cancel;

Expand Down
2 changes: 1 addition & 1 deletion src/test/java/buySellTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public void testBuy() throws IOException {
"Apple Inc", "AAPL", "https://www.apple.com/", "1980-12-12"));
Mockito.when(mockApi.getLastMonthPrices("AAPL")).thenReturn(lastMonthPrices);

BuyInputData buyInputData = new BuyInputData(10.0, "AAPL", "zain");
BuyInputData buyInputData = new BuyInputData(10.0, "AAPL");

BuyOutputBoundary mockBuyPresenter = Mockito.mock(BuyOutputBoundary.class);

Expand Down

0 comments on commit e8b4726

Please sign in to comment.