Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
103 commits
Select commit Hold shift + click to select a range
18530ee
working on UML services
Apr 9, 2018
62516c8
injected accountservice into accountcontroller
Apr 9, 2018
78b29f4
added one controller
wulawrence Apr 10, 2018
7afc470
accountcontroller
wulawrence Apr 11, 2018
7fc3585
uml donezo
Apr 11, 2018
fd8722f
uml with fields
vvg3 Apr 11, 2018
90a2baa
Merge pull request #1 from bth1994/vvg3-patch-1
bth1994 Apr 11, 2018
50ac445
uml take 2
vvg3 Apr 11, 2018
076bb03
Merge pull request #2 from bth1994/vvg3-patch-2
bth1994 Apr 11, 2018
9415070
Delete zipbankuml
bth1994 Apr 11, 2018
9810d54
Merge branch 'master' of https://github.com/bth1994/ZipperBank into uml
Apr 11, 2018
ed63939
autowire constructor so that we can use mocks
wulawrence Apr 11, 2018
c20cbe3
spacing
Apr 11, 2018
7a3e875
Merge branch 'uml' of https://github.com/bth1994/ZipperBank into uml
Apr 11, 2018
2ba2226
Merge branch 'uml' of https://github.com/bth1994/ZipperBank into uml
Apr 11, 2018
651b164
lmk what you said
Apr 11, 2018
09d73b6
deposit controlla and deposit service
Apr 11, 2018
6fb2eef
withdrawals and fixed accounts
wulawrence Apr 11, 2018
538fb9c
bill service and controller stubbies
Apr 11, 2018
a5d4215
Merge branch 'Production' of https://github.com/bth1994/ZipperBank in…
Apr 11, 2018
07d4f44
Merge branch 'Production' of https://github.com/bth1994/ZipperBank in…
Apr 11, 2018
21738c2
fixed constructor in withdrawal
wulawrence Apr 11, 2018
a878237
test
Apr 11, 2018
815c2be
Merge branch 'Production' of https://github.com/bth1994/ZipperBank in…
Apr 11, 2018
768f380
...
Apr 11, 2018
1334e6d
enum for account
Apr 12, 2018
00a606e
enums converted to enumerated
Apr 12, 2018
f662a36
idk
Apr 12, 2018
8c76f8d
entity column annotations
Apr 12, 2018
442d484
springbootapp working
wulawrence Apr 12, 2018
c10c3d9
lowered spring boot parent version
Apr 12, 2018
70504f6
Merge branch 'Production' of https://github.com/bth1994/ZipperBank in…
Apr 12, 2018
9bd44d7
response entity returns
wulawrence Apr 12, 2018
e7d891c
need to work on controllers' returns
wulawrence Apr 12, 2018
8071f05
nothing really
Apr 12, 2018
6f54b03
Merge branch 'Production' of https://github.com/bth1994/ZipperBank in…
Apr 12, 2018
6327ae3
controller types
Apr 12, 2018
162ad36
d
wulawrence Apr 12, 2018
f77e8e6
Merge branch 'Production' of https://github.com/bth1994/ZipperBank in…
wulawrence Apr 12, 2018
b10b14b
added restcontroller annotations
Apr 12, 2018
da27cba
account services
Apr 13, 2018
878a812
first test working
wulawrence Apr 13, 2018
4c9e09a
merged with tests
Apr 13, 2018
a4211d4
service methods
Apr 13, 2018
f66ea5d
idk what this is
Apr 14, 2018
73dbed3
fixed brians mistakes
Apr 14, 2018
3f1ee1b
Merge branch 'Production' into test
Apr 14, 2018
0a3b0e1
forgot
Apr 14, 2018
eff6b6f
Merge branch 'production' into services
Apr 14, 2018
546eab1
finished account service
Apr 14, 2018
2ee6bde
updates to services and controllers
Apr 14, 2018
d62617d
fixed create
Apr 14, 2018
597e9a4
account controller stuff
Apr 14, 2018
f7b540a
merge stuff
Apr 14, 2018
59ec081
for lawrence
Apr 14, 2018
f6b8676
account controller and service changes
Apr 14, 2018
bbf678e
IDK
Apr 14, 2018
03fb2b5
merge
Apr 14, 2018
9eb9517
account is done
Apr 14, 2018
d09ff65
forgot
Apr 14, 2018
29fb75f
merging
Apr 14, 2018
36b497e
converted to crudRepository
Apr 14, 2018
f1aca2f
billcontroller test stuff
Apr 14, 2018
1f8dcf2
changes
Apr 14, 2018
ed75313
billcontroller tests done
Apr 14, 2018
0a3cbb1
Merge branch 'Production' of https://github.com/bth1994/ZipperBank in…
Apr 14, 2018
b352503
accountsbyIdService
wulawrence Apr 14, 2018
98815b6
accountservicesTest
wulawrence Apr 14, 2018
77f5a00
crud done
Apr 14, 2018
ee80808
Merge branch 'Production' of https://github.com/bth1994/ZipperBank in…
Apr 14, 2018
78b4aca
finished accountServiceTests
wulawrence Apr 15, 2018
66087b7
Merge pull request #3 from bth1994/Production
bth1994 Apr 15, 2018
4f7d561
added customer controller tests
Apr 17, 2018
b3ad509
Merge branch 'Production' of https://github.com/bth1994/ZipperBank in…
Apr 20, 2018
e5dea9d
wrote one test for billservice
Apr 20, 2018
6bdfca4
bill service and bill service test complete
Apr 21, 2018
30a637d
withdrawal service complete
wulawrence Apr 21, 2018
23d9027
Merge branch 'Production' of https://github.com/bth1994/ZipperBank in…
wulawrence Apr 21, 2018
62ad35e
this is for you vince
wulawrence Apr 21, 2018
e57a710
merging
Apr 21, 2018
59dba2f
finished withdrawalserviceTest
wulawrence Apr 21, 2018
7999555
merge
Apr 21, 2018
5e606b3
deposit service
Apr 21, 2018
d98d9fc
deposit
Apr 21, 2018
97461e5
update
wulawrence Apr 21, 2018
bad1a94
Merge pull request #4 from bth1994/Production
bth1994 Apr 21, 2018
f4d48c0
Merge branch 'Production' of https://github.com/bth1994/ZipperBank in…
wulawrence Apr 21, 2018
b700938
Merge pull request #5 from bth1994/production
bth1994 Apr 21, 2018
794e355
Merge branch 'Production' of https://github.com/bth1994/ZipperBank in…
wulawrence Apr 21, 2018
0484101
customer service test
Apr 21, 2018
733596c
Merge branch 'Production' into test
Apr 21, 2018
1ddbf4f
adding tests
Apr 21, 2018
4a27bc3
Merge pull request #6 from bth1994/production
bth1994 Apr 21, 2018
dea27f1
more deposit tests
Apr 21, 2018
6da6b7c
Merge branch 'Production' of https://github.com/bth1994/ZipperBank in…
Apr 21, 2018
28610f9
Merge pull request #7 from bth1994/production
bth1994 Apr 21, 2018
7c1c68c
Merge pull request #8 from bth1994/Production
bth1994 Apr 21, 2018
0db415d
go brian go
Apr 21, 2018
954315d
Merge branch 'Production' into test
Apr 21, 2018
912e9c9
fix
Apr 21, 2018
f3d9a9f
done
Apr 21, 2018
c35dde1
Hey we are Done
wulawrence Apr 21, 2018
2ff8779
Merge pull request #9 from bth1994/Production
bth1994 Apr 21, 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
25 changes: 19 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.4.RELEASE</version>
<version>1.5.2.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

<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>
Expand All @@ -38,17 +38,30 @@
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!--<dependency>-->
<!--<groupId>org.hsqldb</groupId>-->
<!--<artifactId>hsqldb</artifactId>-->
<!--<scope>runtime</scope>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>com.h2database</groupId>-->
<!--<artifactId>h2</artifactId>-->
<!--<scope>runtime</scope>-->
<!--</dependency>-->
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<scope>runtime</scope>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
</dependencies>

<build>
Expand Down
14 changes: 14 additions & 0 deletions src/main/java/io/zipcoder/ZcwbankApplication.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,26 @@
package io.zipcoder;

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

import javax.servlet.annotation.WebServlet;

@SpringBootApplication
//@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})
public class ZcwbankApplication {

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

// @Bean
// ServletRegistrationBean h2servletRegistration(){
// ServletRegistrationBean registrationBean = new ServletRegistrationBean( new org.h2.server.web.WebServlet());
// registrationBean.addUrlMappings("/console/*");
// return registrationBean;
// }
}
45 changes: 45 additions & 0 deletions src/main/java/io/zipcoder/controllers/AccountController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package io.zipcoder.controllers;

import io.zipcoder.entities.Account;
import io.zipcoder.services.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;


@RestController
public class AccountController {

@Autowired
private AccountService accountService;

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

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

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

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

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

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

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

@RestController
public class BillController {

private BillService billService;

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

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

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

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

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

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

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

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

import io.zipcoder.entities.Customer;
import io.zipcoder.services.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 = "/accounts/{accountId}/customer", method = RequestMethod.GET)
public ResponseEntity<Customer> getCustomerByAccountId(@PathVariable Long accountId) {
return customerService.getCustomerByAccountId(accountId);
}

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

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

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

@RequestMapping(value = "/customers/{customerId}", method = RequestMethod.PUT)
public ResponseEntity<Customer> updateCustomer(@PathVariable Long customerId, @RequestBody Customer customer) {
return customerService.updateCustomer(customerId, customer);
}

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

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

@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<Iterable<Deposit>> getAllDeposits(@PathVariable Long accountId) {
return this.depositService.getAllDepositsFromAccount(accountId);
}

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

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

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

@RequestMapping(value = "/deposits/{depositId}", method = RequestMethod.DELETE)
public ResponseEntity deleteDeposit(@PathVariable Long depositId) {
return this.depositService.deleteDeposit(depositId);
}
}
35 changes: 35 additions & 0 deletions src/main/java/io/zipcoder/controllers/WithdrawalController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package io.zipcoder.controllers;

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

@RestController
public class WithdrawalController {

@Autowired
private WithdrawalService withdrawalService;

@RequestMapping(value = "/accounts/{accountId}/withdrawals", method = RequestMethod.GET)
public ResponseEntity<Iterable<Withdrawal>> getAllWithdrawalsFromAccountId(@PathVariable Long accountId){
return withdrawalService.getAllWithdrawalsFromAccountId(accountId);
}
@RequestMapping(value = "/withdrawals/{withdrawalId}", method = RequestMethod.GET)
public ResponseEntity<Withdrawal> getWithdrawalsByWithdrawalId(@PathVariable Long withdrawalId){
return withdrawalService.getWithdrawalsByWithdrawalId(withdrawalId);
}
@RequestMapping(value = "/accounts/{accountId}/withdrawals", method = RequestMethod.POST)
public ResponseEntity<Withdrawal> createWithdrawal(@PathVariable Long accountId, @RequestBody Withdrawal withdrawal){
return withdrawalService.createWithdrawal(accountId, withdrawal);
}
@RequestMapping(value = "/withdrawals/{withdrawalId}", method = RequestMethod.PUT)
public ResponseEntity<Withdrawal> updateWithdrawal(@PathVariable Long withdrawalId, @RequestBody Withdrawal withdrawal){
return withdrawalService.updateWithdrawal(withdrawalId, withdrawal);
}
@RequestMapping(value = "/withdrawals/{withdrawalId}", method = RequestMethod.DELETE)
public ResponseEntity deleteWithdrawal(@PathVariable Long withdrawalId){
return withdrawalService.deleteWithdrawal(withdrawalId);
}
}
88 changes: 88 additions & 0 deletions src/main/java/io/zipcoder/entities/Account.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
package io.zipcoder.entities;

import io.zipcoder.utilities.AccountType;

import javax.persistence.*;

@Entity
public class Account {

@Id
@GeneratedValue
@Column(name = "ACCOUNT_ID")
private Long id;

@Enumerated(value = EnumType.STRING)
@Column(name = "ACCOUNT_TYPE")
private AccountType type;

@Column(name = "NICKNAME")
private String nickname;

@Column(name = "REWARDS_POINTS")
private Integer rewards;

@Column(name = "ACCOUNT_BALANCE")
private Double balance;

@ManyToOne
@JoinColumn(name = "CUSTOMER_ID")
private Customer customer;

public Account(){}

public Account(String nickname, AccountType type, Double balance, Customer customer){
this.nickname = nickname;
this.type = type;
this.balance = balance;
this.customer = customer;
}

public Long getId() {
return id;
}

public void setId(Long id) {
this.id = id;
}

public AccountType getType() {
return this.type;
}

public void setType(AccountType type) {
this.type = type;
}

public String getNickname() {
return nickname;
}

public void setNickname(String nickname) {
this.nickname = nickname;
}

public Integer getRewards() {
return rewards;
}

public void setRewards(Integer rewards) {
this.rewards = rewards;
}

public Double getBalance() {
return balance;
}

public void setBalance(Double balance) {
this.balance = balance;
}

public Customer getCustomer() {
return customer;
}

public void setCustomer(Customer customer) {
this.customer = customer;
}
}
Loading