Implementation of the assignment given by Cushon
The requirements of the assignment can be found here
Documentation and Diagrams for the design of the application can be found below:
Ensure that you have the following installed:
make check
- checks the repo for any vulnerability, lint issues and runs the unit testsmake start
- runs the docker containers for the db and api in the backgroundmake stop
- stops the db and removes the docker containermake start-local
- runs DB in docker container while the API runs locally on your host machinemake logs-api
to get logs from the api docker container
- Run
make start
to run API and DB (both will be running in their own separate docker container) - Make requests to the API via Postman using the Postman Collection or curl commands in a separate shell. Endpoints available can be found in the swagger spec
curl -X POST http://localhost:8080/v0/transactions -H "Content-Type: application/json" -d '{"customer_accounts_funds_id": 1, "amount": 25000}'
- Check logs in the container to get information about the requests being made
- Run
make logs-api
to get logs from the api container
- Connect to the DB locally via a database administration software - e.g. DBBeaver using the configurations at the top of the Makefile to see the data itself in the database
- Run
make stop
to stop the DB and API
Run make start-local
to run DB in docker container while the API runs locally on your host machine
- This option is useful if you want to see the logs of the API on your shell
- Remember to
Ctrl+C
to stop the API - Remember to
make stop
to stop the DB container
Informtion about scripts can be found here
- Each Company has specific set of funds that the employers can choose from
- Employer customer data and direct customer data are the same
- We can purge data in our system otherwise a status needs to be added to the data entities where the status would become 'Deleted' even though the data still exists in the DB
- Each account has specific funds and those funds do not share with other account types
- Other assumptions can be found in the other READMEs located in the repo which are related to the topics discussed in that README
- Run tests in parallel while being mindful of data race - https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/loopclosure
- Sensitive data (e.g. DB_PASS) should be retrieved from a vault or secrets managers
- Create sequence diagrams for the other handlers
- Add type to transactions to distinguish from personal, interest, etc
- Add profit/loss in investments so user can see a summary of how much they have gained
- Handling different types of currency
- Other endpoints can be added for more functionality
- Making backups of data
- Add more tests
- Add integration test for postgres db functions
- Add integration test at api-level but use BDD-style test
- Other enchanments can be found in the other READMEs located in the repo which are related to the topics discussed in that README
- Update db tables and models to add all the fields mentioned in the class diagram
- Project Structuring was based on https://github.com/golang-standards/project-layout to follow idiomatic Go patterns