As part of out latest MVP build we need to present a user with some insights about their spending. We need to build an application (React or React Native) that displays insights on their transactioinos. A list of transactions for a user can be retrieved at GET https://gist.githubusercontent.com/simeor/5dd52dccdf5c4b4183ab2f2e80728bec/raw/5d042617ce514687fedffba35ec04539cb173481/data.json
. The applicatiion should fetch this list, then calculate the insights below, and display them in a style of your choosing.
The api returns an array of transactions:
[
{
"id": 1,
"amount": 100,
"merchant": "Tescos Ltd",
"category": "food",
"paymentDate": "2019-01-27T14:24:48.960Z"
},
{
"id": 2,
"amount": 20,
"merchant": "TFL London",
"category": "transport",
"paymentDate": "2019-02-27T14:24:48.960Z"
}
]
Categories
User Story:
As a User
So that I can gain an understanding of my finances
I want to see an aggregated list of my transactions by category
Displays the number, total and average value of all transactions grouped by the transaction category as well as the transactions themselves.
The category grouped object should be as follows
{
"food": {
"totalNumber": 10,
"totalValue": 400,
"averageValue": 40,
},
...
}
Cashflow
User Story:
As a User
So that I can gain an understanding of if i will run out of money
I want to see a breakdown of my spending by month
Displays a daily cashflow of all transactions grouped by day as well as the transactions themselves. For days on which there is no data return 0 for all fields.
{
"01/01/2019": {
"totalNumber": 10,
"totalValue": 400,
"averageValue": 40
},
"02/01/2019": {
"totalNumber": 10,
"totalValue": 400,
"averageValue": 40
}
}
Create your own solution in a seperate repo and submit it.
There are no requirements for the layout or routing fo your app, make them as you see fit.
- All values are integer. Display values must be floats to 2 decimal places.
- You can use any npm package you like.
- BONUS marks for using Typescript.
- BONUS BONUS marks for using Typescript with no
any
types.
- Well tested code. Whatever framework you use, we like testing our code to have certainty it works
- Simple code. It shouldn't take a PHD to understand code. If it's that complicated, we've done something wrong.
- Code reuse. If there's an option to reuse some code, go for it!
As part of out latest MVP build we need to present a user with some insights about their spending. We need to build a server that returns JSON formatted insights. A list of transactions for a user can be retrieved at GET https://gist.githubusercontent.com/simeor/5dd52dccdf5c4b4183ab2f2e80728bec/raw/5d042617ce514687fedffba35ec04539cb173481/data.json
. (Make sure you use https!!!). The server should fetch this list, then calculate the insights below, and return them in the body of the response with a 200 response code.
The api returns an array of transactions:
[
{
"id": 1,
"amount": 100,
"merchant": "Tescos Ltd",
"category": "food",
"paymentDate": "2019-01-27T14:24:48.960Z"
},
{
"id": 2,
"amount": 20,
"merchant": "TFL London",
"category": "transport",
"paymentDate": "2019-02-27T14:24:48.960Z"
}
]
From this list we'll need to build a server that exposes the following routes, which calculate different insights about a users spending depending on which route is called:
GET /insights/categories
User Story:
As a User
So that I can gain an understanding of my finances
I want to see an aggregated list of my transactions by category
returns the number, total and average value of all transactions grouped by the transaction category.
{
"food": {
"totalNumber": 10,
"totalValue": 400,
"averageValue": 40
},
...
}
GET /insights/cashflow
User Story:
As a User
So that I can gain an understanding of if i will run out of money
I want to see a breakdown of my spending by month
returns a daily cashflow of all transactions grouped by day. For days on which there is no data return 0 for all fields.
{
"01/01/2019": {
"totalNumber": 10,
"totalValue": 400,
"averageValue": 40
},
"02/01/2019": {
"totalNumber": 10,
"totalValue": 400,
"averageValue": 40
}
}
git clone https://github.com/jigsawxyz/recruitment-uk.git
npm i
npm t
- all values are integer. Don't worry about dealing with floating point precisions, the front end can deal with the presentation logic.
- you can use any npm package you like, but only with good reason! This includes the testing framework which you can change :)
- We've provided some boilerplate code, but feel free to rearrange as you want...
- There's a little test script we've written which will start the server, run the tests and pull it down again. But feel free to orchastrate your tests however you want!
- Well tested code. Whatever framework you use, we like testing our code to have certainty it works
- Simple code. It shouldn't take a PHD to understand code. If it's that complicated, we've done something wrong.
- Code reuse. If there's an option to reuse some code, go for it!