Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
0ba1245
building out controller/domain/repository/service
Apr 12, 2018
df473e9
first commit
Apr 12, 2018
4fdd210
Pushing up current WithDepoRepo
PeterMcCormick Apr 12, 2018
75ec9cc
account almost done, customer halfway done
Apr 13, 2018
d560f68
second commit
Apr 13, 2018
4394416
Pushing up current WithDepoRepo
PeterMcCormick Apr 13, 2018
f963734
tried to create mysql database, don't have it functional yet
Apr 13, 2018
acdff82
Domain Controller and REPO set up, working on Service
PeterMcCormick Apr 13, 2018
769ca71
Some more progress into service
PeterMcCormick Apr 13, 2018
0bdcc9c
updated java version to 1.8
Apr 13, 2018
9fc78de
all working(I think), postman tested half of the methods, yet to star…
Apr 13, 2018
6c0dae9
Friday 04/13 648pm
Apr 13, 2018
b03b860
Merge remote-tracking branch 'carolynnmarie/Carolynn' into carolynnMe…
Apr 14, 2018
aa238ef
started adding mockito testing
Apr 14, 2018
005aa19
added @JoinColumn to accountId, changed accountID, adding getAllBills…
Apr 14, 2018
3b2bb2f
finished POST method, need to test
Apr 14, 2018
a9c8238
all controller methods working in postman, started creating mockito t…
Apr 14, 2018
5e2c4a7
Merge remote-tracking branch 'carolynnmarie/Carolynn' into carolynnMe…
Apr 14, 2018
1339629
finished adding all http methods
Apr 14, 2018
a012924
Save before pull down and merge
PeterMcCormick Apr 14, 2018
8b7d1c9
Merge remote-tracking branch 'romerolanguages/carolynnMergeIntoBillTe…
PeterMcCormick Apr 14, 2018
3cc8a7a
added junit dependency
Apr 14, 2018
58de2a2
added more test classes
Apr 14, 2018
61ebb68
Service Methods Created
PeterMcCormick Apr 14, 2018
8c45ecd
fixing bill, small stuff
Apr 14, 2018
cdb1491
adding methods to BillRepository
Apr 14, 2018
a427f4e
changing getAllBillsForAccount method
Apr 14, 2018
383e96c
really actually all methods in accounts and customers work the way th…
Apr 15, 2018
0036994
final before merging
Apr 15, 2018
99d124e
Merge remote-tracking branch 'carolynnmarie/Carolynn' into dev
Apr 15, 2018
58450ba
Reverted changes back to base
PeterMcCormick Apr 15, 2018
4e37e63
fixed repo
PeterMcCormick Apr 15, 2018
cce7a60
Merge remote-tracking branch 'romerolanguages/master' into withdraw
PeterMcCormick Apr 15, 2018
0209591
Finished up changing service
PeterMcCormick Apr 15, 2018
13ea5e2
committing to merge Petes changes
Apr 27, 2018
2fdf401
after merging petes changes
Apr 27, 2018
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
37 changes: 36 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,16 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.7</java.version>
<java.version>1.8</java.version>
</properties>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
Expand All @@ -44,11 +50,40 @@
<scope>runtime</scope>
</dependency>

<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.6</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>2.18.0</version>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-test -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>4.3.13.RELEASE</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-test-autoconfigure</artifactId>
<version>1.5.9.RELEASE</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/io/zipcoder/ZcwbankApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;

@SpringBootApplication
public class ZcwbankApplication {

public static void main(String[] args) {
SpringApplication.run(ZcwbankApplication.class, args);
}


}
51 changes: 51 additions & 0 deletions src/main/java/io/zipcoder/controller/AccountController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package io.zipcoder.controller;


import io.zipcoder.domain.Account;
import io.zipcoder.domain.Customer;
import io.zipcoder.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.RequestEntity;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

@RestController
public class AccountController {
@Autowired
private AccountService accountService;


public AccountController(AccountService accountService){
this.accountService = accountService;
}

@RequestMapping(value = "/accounts", method = RequestMethod.GET)
public ResponseEntity<?> getAllAccounts(){
return accountService.getAllAccounts();
}

@RequestMapping(value = "/accounts/{accountId}", method = RequestMethod.GET)
public ResponseEntity<?> getAccountById(@PathVariable("accountId") Long accountId){
return accountService.getAccountById(accountId);
}

@RequestMapping(value = "/customers/{customerId}/accounts", method = RequestMethod.GET)
public ResponseEntity<?> getAccountsForCustomer(@PathVariable("customerId") Long customerId){
return accountService.getAccountsOfCustomer(customerId);
}

@RequestMapping(value = "/customers/{customerId}/accounts", method = RequestMethod.POST)
public ResponseEntity<?> createAccount(@PathVariable ("customerId") Long customerId, @RequestBody Account account){
return accountService.createAccount(customerId, account);
}

@RequestMapping(value = "/accounts/{accountId}", method = RequestMethod.PUT)
public ResponseEntity<?> updateAccount(@PathVariable("accountId") Long accountId, @RequestBody Account account){
return accountService.updateAccount(account, accountId);
}

@RequestMapping(value = "/accounts/{accountId}", method = RequestMethod.DELETE)
public ResponseEntity<?> deleteAccount(@PathVariable("accountId") Long accountId){
return accountService.deleteAccount(accountId);
}
}
53 changes: 53 additions & 0 deletions src/main/java/io/zipcoder/controller/BillController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package io.zipcoder.controller;

import io.zipcoder.domain.Bill;
import io.zipcoder.service.BillService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

@RestController
public class BillController {

@Autowired
private BillService billService;

public BillController() {}

public BillController(BillService billService) {
this.billService = billService;
}

@RequestMapping(value="/accounts/{accountId}/bills", method= RequestMethod.GET)
public ResponseEntity<Iterable<Bill>> getAllBillsForAccount(@PathVariable("accountId") Long accountId) {
return billService.getAllBillsForAccount(accountId);
}

@RequestMapping(value="/bills/{billId}", method= RequestMethod.GET)
public ResponseEntity<Bill> getBillById(@PathVariable("billId") Long billId) {
return billService.getBillById(billId);
}

@RequestMapping(value="/customers/{customerId}/bills", method= RequestMethod.GET)
public ResponseEntity<Iterable<Bill>> getAllBillsForCustomer(@PathVariable Long customerId) {
return billService.getAllBillsForCustomer();
}

@RequestMapping(value="/accounts/{accountId}/bills", method = RequestMethod.POST)
public ResponseEntity<?> createBill(@PathVariable Long accountId, @RequestBody Bill bill) {
return billService.createBill(bill);
}

@RequestMapping(value = "/bills/{billId}", method = RequestMethod.PUT)
public ResponseEntity<?> updateBill(@PathVariable Long billId, @RequestBody Bill bill) {
return billService.updateBill(bill);
}

@RequestMapping(value = "/bills/{billId}", method = RequestMethod.DELETE)
public ResponseEntity<?> deleteBill(@PathVariable Long billId) {
return billService.deleteBill(billId);
}



}
47 changes: 47 additions & 0 deletions src/main/java/io/zipcoder/controller/CustomerController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package io.zipcoder.controller;


import io.zipcoder.domain.Account;
import io.zipcoder.domain.Customer;
import io.zipcoder.repository.CustomerRepository;
import io.zipcoder.service.AccountService;
import io.zipcoder.service.CustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

@RestController
public class CustomerController {

private CustomerService customerService;

@Autowired
public CustomerController(CustomerService customerService){
this.customerService = customerService;
}

@RequestMapping(value = "/customers", method = RequestMethod.GET)
public ResponseEntity<Iterable<Customer>> getAllCustomers(){
return customerService.getAllCustomers();
}

@RequestMapping(value = "/customers/{id}", method = RequestMethod.GET)
public ResponseEntity<Customer> getCustomerById(@PathVariable("id") Long id){
return customerService.getCustomerById(id);
}

@RequestMapping(value = "/accounts/{accountId}/customer", method = RequestMethod.GET)
public ResponseEntity<Customer> getCustomer(@PathVariable("accountId") Long accountId){
return customerService.getCustomerOfAccount(accountId);
}

@RequestMapping(value = "/customers", method = RequestMethod.POST)
public ResponseEntity<?> createCustomer(@RequestBody Customer customer){
return customerService.createCustomer(customer);
}

@RequestMapping(value = "/customers/{id}", method = RequestMethod.PUT)
public ResponseEntity<?> updateCustomer(@PathVariable("id") Long id, @RequestBody Customer customer){
return customerService.updateCustomer(customer, id);
}
}
48 changes: 48 additions & 0 deletions src/main/java/io/zipcoder/controller/DepositController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package io.zipcoder.controller;


import io.zipcoder.domain.Deposit;
import io.zipcoder.service.DepositService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
public class DepositController {


private DepositService depositService;

@Autowired
public DepositController(DepositService depositService) {
this.depositService = depositService;
}

@RequestMapping(value="/accounts/{accountId}/deposits", method = RequestMethod.GET)
public ResponseEntity<?> getDepositsByAccount(@PathVariable("accountId") Long accountId) {
return depositService.getDepositsByAccount(accountId);
}

@RequestMapping(value="/deposits/{depositId}", method = RequestMethod.GET)
public ResponseEntity<?> getDeposit(@PathVariable("depositId") Long depositId) {
return depositService.getDeposit(depositId);
}

@RequestMapping(value="/accounts/{accountId}/deposits", method = RequestMethod.POST)
public ResponseEntity<?> createDeposit(@PathVariable("accountId") Long accountId, @RequestBody Deposit deposit) {
return depositService.createDeposit(deposit, accountId);
}

@RequestMapping(value="/deposits/{depositId}", method = RequestMethod.PUT)
public ResponseEntity<?> updateDeposit(@PathVariable("depositId") Long depositId, @RequestBody Deposit deposit) {
return depositService.updateDeposit(deposit, depositId);
}

@RequestMapping(value="/deposits/{depositId}", method = RequestMethod.DELETE)
public ResponseEntity<?> deleteDeposit(@PathVariable("depositId") Long depositId) {
return depositService.deleteDeposit(depositId);
}

}
45 changes: 45 additions & 0 deletions src/main/java/io/zipcoder/controller/WithdrawalController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package io.zipcoder.controller;

import io.zipcoder.domain.Withdrawal;
import io.zipcoder.service.WithdrawalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
public class WithdrawalController {

@Autowired
private WithdrawalService withdrawalService;

public WithdrawalController(WithdrawalService withdrawalService) {
this.withdrawalService = withdrawalService;
}

@RequestMapping(value="accounts/{acountId}/withdrawals", method = RequestMethod.GET)
public ResponseEntity<?> getWithdrawalsByAccount(@PathVariable("accountId") Long accountId) {
return withdrawalService.getWithdrawalsByAccount(accountId);
}

@RequestMapping(value="/withdrawals/{withdrawalId}", method = RequestMethod.GET)
public ResponseEntity<?> getWithdrawal(@PathVariable("withdrawalId") Long withdrawalId) {
return withdrawalService.getWithdrawal(withdrawalId);
}

@RequestMapping(value="/accounts/{accountId}/withdrawals", method = RequestMethod.POST)
public ResponseEntity<?> createWithdrawal(@PathVariable("accountId") Long accountId, @RequestBody Withdrawal withdrawal) {
return withdrawalService.createWithdrawal(withdrawal, accountId);
}

@RequestMapping(value="/withdrawals/{withdrawalId}" , method = RequestMethod.PUT)
public ResponseEntity<?> updateWithdrawal(@PathVariable("withdrawalId") Long withdrawalId, @RequestBody Withdrawal withdrawal) {
return withdrawalService.updateWithdrawal(withdrawal, withdrawalId);
}

@RequestMapping(value="/withdrawals/{withdrawalId}", method = RequestMethod.DELETE)
public ResponseEntity<?> deleteWithdrawal(@PathVariable("withdrawalId") Long withdrawalId) {
return withdrawalService.deleteWithdrawal(withdrawalId);
}
}
Loading