Giter Site home page Giter Site logo

crud-bank-app's Introduction

CRUD Bank App ๐Ÿฆ

Description

The CRUD Bank App is a banking application that allows users to manage various types of accounts, make deposits, withdrawals, earn yield, and perform transfers between accounts.

Class Diagram

UML Class Diagram

Setup

To set up and run the project locally, follow these steps:

  1. Clone the repository.
  2. Configure your database settings in the application.properties file.
  3. Build and run the application using your preferred IDE or the command line.

Technologies Used

  • Java
  • Spring Boot
  • Spring Data JPA
  • Hibernate
  • H2 Database

Controllers and Routes Structure

The project follows a RESTful API structure with the following main controllers and routes:

Account Controller

  • GET /api/accounts/checking: Get all checking accounts.
  • GET /api/accounts/checking/{accountNumber}: Get a checking account by account number.
  • GET /api/accounts/checking/owner/{name}: Get a checking account by owner.
  • POST /api/accounts/checking: Create a new checking account.
  • PUT /api/accounts/checking/{accountNumber}: Update a checking account.
  • PATCH /api/accounts/checking/transfer/{fromId}/{destinationId}/{amount}: Transfer funds between accounts.
  • DELETE /api/accounts/checking/{accountNumber}: Delete a checking account.

Investment Account Controller

  • GET /api/accounts/investment: Get all investment accounts.
  • GET /api/accounts/investment/{accountNumber}: Get an investment account by account number.
  • POST /api/accounts/investment: Create a new investment account.
  • PUT /api/accounts/investment/{accountNumber}: Update an investment account.
  • DELETE /api/accounts/investment/{accountNumber}: Delete an investment account.

Future Work

Some potential future enhancements for the project include:

  • Adding user authentication and authorization.
  • Implementing additional account types (e.g., savings, credit).
  • Enhancing error handling and validation.
  • Adding more advanced transaction features.

Resources

Code Examples

InvestmentAccount.java

private void liquidateDeposits(BigDecimal withdrawalAmount) {
    LocalDate currentDate = LocalDate.now();

    List<Deposit> depositsToDelete = new ArrayList<>();
    for (Deposit deposit : deposits) {
        if (currentDate.isAfter(deposit.getUnlockDate())) {
            BigDecimal depositAmount = calculateAmountWithInterest(deposit);
            if (withdrawalAmount.compareTo(depositAmount) >= 0) {
                withdrawalAmount = withdrawalAmount.subtract(depositAmount);
                setBalance(getBalance().subtract(depositAmount));
                depositsToDelete.add(deposit);
            } else if (withdrawalAmount.compareTo(depositAmount) < 0) {
                deposit.setAmount(depositAmount.subtract(withdrawalAmount));
                setBalance(getBalance().subtract(deposit.getAmount()));
                withdrawalAmount = BigDecimal.valueOf(0);
            }
        }
    }
    for (Deposit deposit : depositsToDelete) {
        deposits.remove(deposit);
    }
}

crud-bank-app's People

Contributors

guillermoaviles avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.