Application to store incoming and outgoing financial transactions, which should allow the registration and listing of these transactions.
- Install yarn and run the cmd
$ git clone https://github.com/robertokbr/BankTransactions.git
$ cd BankTransactions
$ yarn
$ yarn dev:server
- The route receives
title
,value
andtype
within the body of the request,type
is the type of the transaction,income
for incoming (deposits) andoutcome
for outgoing (withdrawn). When registering a new transaction, it is stored inside an object with the following format
{
"id": "uuid",
"title": "Salário",
"value": 3000,
"type": "income"
}
GET / transactions
: This route will return a listing with all the transactions you have registered so far, together with the sum of entries, withdrawals and total credit. This route returns an object with the following format:
transactions: [
{
id: 'uuid', title: 'Salário', value: 4000, type: 'income'
},
{
id: 'uuid', title: 'Freela', value: 2000, type: 'income'
},
{
id: 'uuid', title: 'Pagamento da fatura', value: 4000, type: 'outcome'
},
{
id: 'uuid', title: 'Cadeira Gamer', value: 1200, type: 'outcome'
},
],
balance: {
income: 6000,
outcome: 5200,
total: 800
},
Within balance, income is the sum of all values of transactions with type
income. The outcome is the sum of all transaction values with type
outcome, and the total is the income - outcome
value.
Able to create a new transaction
:The application allows a transaction to be created, and returns a json with the created transaction.Able to list the transactions
: The application allows an object to be returned containing all transactions together with the balance of income, outcome and total transactions that have been created so far.Not able to create outcome transaction without a valid balance
:The application must not allow a transaction of the outcome type to extrapolate the total amount that the user has in the box, returning a response with HTTP 400 code and an error message in the following format:{ error: string }
- Within balance, income is the sum of all values of transactions with type income. The outcome is the sum of all transaction values with type outcome, and the total is the income - outcome value.
- 🍴 Fork this repo!
- 👯 Clone this repo to your local machine using
LINK
- 🎋 Create your feature branch using
git checkout -b my-feature
- ✅ Commit your changes using
git commit -m 'feat: My new feature'
;
- 📌 Push to the branch using
git push origin my-feature
;
- 🔃 Create a new pull request
After your Pull Request is merged, can you delete your feature branch.