At Moneyhub we use microservices to partition and separate the concerns of the codebase. In this exercise we have given you an example admin service and some accompanying services to work with. In this case the admin service backs a front end admin tool allowing non-technical staff to interact with data.
A request for a new admin feature has been received
- As an admin, I want to be able to generate a CSV report showing the values of all user investment holdings
- Any new routes should be added to the admin service
- The csv report should be sent to the
/exportroute of the investments service - The investments
/exportroute expects the following:- content-type as
application/json - JSON object containing the report as csv string, i.e,
{csv: '|User|First Name|...'}
- content-type as
- The csv should contain a row for each holding matching the following headers |User|First Name|Last Name|Date|Holding|Value|
- The Holding property should be the name of the holding account given by the financial-companies service
- The Value property can be calculated by
investmentTotal * investmentPercentage - The new route in the admin service handling the generation of the csv report should return the csv as text with content type
text/csv
- Ensure use of up to date packages and libraries (the service is known to use deprecated packages but there is no expectation to replace them)
- Make effective use of git
We prefer:
- Functional code
- Ramda.js (this is not a requirement but feel free to investigate)
- Unit testing
All of you work should take place inside the admin microservice
For the purposes of this task we would assume there are sufficient security middleware, permissions access and PII safe protocols, you do not need to add additional security measures as part of this exercise.
You are free to use any packages that would help with this task
We're interested in how you break down the work and build your solution in a clean, reusable and testable manner rather than seeing a perfect example, try to only spend around 1-2 hours working on it
Please make sure to update the readme with:
- Your new routes
- How to run any additional scripts or tests you may have added
- Relating to the task please add answers to the following questions;
- How might you make this service more secure?
- How would you make this solution scale to millions of records?
- What else would you have liked to improve given more time?
On completion email a link to your repository to your contact at Moneyhub and ensure it is publicly accessible.
Please clone this service and push it to your own github (or other) public repository
To develop against all the services each one will need to be started in each service run
npm start
or
npm run developThe develop command will run nodemon allowing you to make changes without restarting
The services will try to use ports 8081, 8082 and 8083
Use Postman or any API tool of you choice to trigger your endpoints (this is how we will test your new route).
We have provided a series of routes
Investments - localhost:8081
/investmentsget all investments/investments/:idget an investment record by id/investments/exportexpects a csv formatted text input as the body
Financial Companies - localhost:8082
/companiesget all companies details/companies/:idget company by id
Admin - localhost:8083
/investments/:idget an investment record by id