Skip to content
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
24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/ood-bank-challenge.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["Vue.volar", "Vue.vscode-typescript-vue-plugin"]
}
47 changes: 47 additions & 0 deletions README-PROJECT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Bank

This challenge helps you practice your OO design skills.

You'll work alone, and you'll also review your own code so you can practice reflecting on and improving your own work.

## Specification

### Requirements

* You should be able to interact with your code via a JavaScript REPL - Node REPL or browser console (You don't need to implement a command line interface that takes input from STDIN.)
* Deposits, withdrawal.
* Account statement (date, credit or debit amount, balance) printing.
* Data can be kept in memory (it doesn't need to be stored to a database or anything).

### Acceptance criteria

**Given** a client makes a deposit of 1000 on 10-01-2012
**And** a deposit of 2000 on 13-01-2012
**And** a withdrawal of 500 on 14-01-2012
**When** she prints her bank statement
**Then** she would see

```
date || credit || debit || balance
14/01/2012 || || 500.00 || 2500.00
13/01/2012 || 2000.00 || || 3000.00
10/01/2012 || 1000.00 || || 1000.00
```


#### Standard
- [X] Meets the spec
- [X] Developed test-first (commit your tests before your source code to provide evidence of this)
- [X] Passes tests
- [X] Encapsulates adding and storing Transactions in a class
- [X] Encapsulates Statement formatting in a class
- [X] Encapsulates Transaction data in a class

#### Extensions
- [ ] Generate ordered bank statements between 2 dates
- [ ] Disable withdraws if the withdraw amount exceeds the available funds. Available funds must be calculated based on a complete transaction history, not a variable that gets updated
- [ ] Allow adding a 500 overdraft to the account
- [ ] Different account types (Savings, Investment, Checking). Savings & Investment accounts cant have overdrafts, Checking accounts can. Investment accounts accumulate 2% interest every month.
- [ ] Deposit limits of 20,000 per year on Savings accounts
- [X] A front-end online banking app
- [X] Generate PDFs of bank statements
82 changes: 37 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,47 +1,39 @@
# Bank

This challenge helps you practice your OO design skills.

You'll work alone, and you'll also review your own code so you can practice reflecting on and improving your own work.

## Specification

### Requirements

* You should be able to interact with your code via a JavaScript REPL - Node REPL or browser console (You don't need to implement a command line interface that takes input from STDIN.)
* Deposits, withdrawal.
* Account statement (date, credit or debit amount, balance) printing.
* Data can be kept in memory (it doesn't need to be stored to a database or anything).

### Acceptance criteria

**Given** a client makes a deposit of 1000 on 10-01-2012
**And** a deposit of 2000 on 13-01-2012
**And** a withdrawal of 500 on 14-01-2012
**When** she prints her bank statement
**Then** she would see

```
date || credit || debit || balance
14/01/2012 || || 500.00 || 2500.00
13/01/2012 || 2000.00 || || 3000.00
10/01/2012 || 1000.00 || || 1000.00
```


#### Standard
- [ ] Meets the spec
- [ ] Developed test-first (commit your tests before your source code to provide evidence of this)
- [ ] Passes tests
- [ ] Encapsulates adding and storing Transactions in a class
- [ ] Encapsulates Statement formatting in a class
- [ ] Encapsulates Transaction data in a class

#### Extensions
- [ ] Generate ordered bank statements between 2 dates
- [ ] Disable withdraws if the withdraw amount exceeds the available funds. Available funds must be calculated based on a complete transaction history, not a variable that gets updated
- [ ] Allow adding a 500 overdraft to the account
- [ ] Different account types (Savings, Investment, Checking). Savings & Investment accounts cant have overdrafts, Checking accounts can. Investment accounts accumulate 2% interest every month.
- [ ] Deposit limits of 20,000 per year on Savings accounts
- [ ] A front-end online banking app
- [ ] Generate PDFs of bank statements
## Short note from author
This project has been written in Vue with the use of (mainly) **TailwindCSS**, **DaisyUI** and **Pinia**.
- **Vue** due to personal preference
- **TailwindCSS** and **DaisyUI** for unstyled components
- **Pinia** for state management

## Instructions
- Clone the project
- Install dependencies (`npm install`)
- Run the project on local network (`npm dev`)

## Review
- [X] Have you written a README explaining your approach, perhaps a domain model, instructions to install, run app, run tests, and examples of interactions?
- You are reading it right now :)
- [X] Did you start with a feature test first?
- I started by building the skeleton of the user interface, but the logic itself I have written TDD way so I would say yes.
- [X] Do all your tests pass? (How do you know?)
- They pass because I have ran the unit tests ;)
- [X] Does your program have sufficient test coverage? (How do you know?)
- Yes and no. The backend service is fully covered (banking.ts and transaction.ts) but the UI elements are not tested due to time constraints.
- [X] Have you linted your code? (How do you know?)
- The code is linted thanks to the auto-linter installed in my IDE, every file save automatically lints the code. Linting module is not included in this project as I have felt no reason to install it for a project I'll be working on alone (of course that is a subject to change if I had to work with someone other than me)
- [X] Do you have 3 or more classes?
- Thats a yes
- [X] Are your methods no longer than 5 lines?
- At most 6 ;)
- [X] Is the complexity of your methods low? (How do you know?)
- Because I do not overuse loops and (most of) my methods are straightforward. The code is as light as I could make it in one day time. If I had to guess, most of the methods have the complexity of O(1) or O(n) but that's a **complete** guess.
- [X] Are all parts of the statement format in presentation-specific classes? (Statement, lineItem etc)
- I guess so? (I am actually not sure, please check the Dashboard element if it fits the criteria)
- [X] Have you encapsulated transaction data in a class?
- Yes and no, the transaction logic is handled in a class of its own, but due to unforeseen limitations (or my lack of skill) I had to make some adjustements noted in generator.ts
- [ ] Have you encapsulated adding to the transactions array in a class?
- Not sure
- [ ] Are all your class dependencies (even Date? (!)) injected rather than hard-coded?
- Not sure
- [X] Are all your unit tests isolated?
13 changes: 13 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en" data-theme="lofi">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/bank-icon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>BooleanUK - Banking</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
4 changes: 4 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export default {
preset: "ts-jest",
testEnvironment: "node",
};
Loading