Test for Backbase that consist of building a web platform that allows users to calculate currency exchanges rates
License: MIT
- Linux/Mac (This project was built using Ubuntu, therefore, other operating systems are not covered)
- Docker >= 25.0.4 (official installation guide)
- docker-compose >= 1.29.2 (official installation guide)
- Open a terminal on the root folder of the project
- Execute
docker-compose -f local.yml up
to start the app (for a complete view on the start, go to local.yml)- To clean the container, execute
docker-compose -f local.yml down
- To clean the container, execute
Because this project was built to be used only with docker, every command has to be done towards the container.
Always execute the commands from the root of the project!!!
-
To create a normal user account, just go to Sign Up and fill out the form. Once you submit it, you'll see a "Verify Your E-mail Address" page.
-
To create a superuser account, use this command:
$ docker-compose -f local.yml run --rm django python manage.py createsuperuser
To verify the user, check your console for a simulated email verification message. Copy the link into your browser. Now the user's email should be verified and ready to go.
$ docker-compose -f local.yml run --rm django python manage.py test
This project has two main Docker containers: a Python container to contain the django app and a postgres docker container.
This django app has the following parts (each of them has their own README.md):
- currency: core of the django app, where there are the main models and django admin views
- currency_rates: service that allows to retrieve the rate value of a given currency to the rest of them between two given dates
- currency_converter: service that allows to obtain the latest exchange value from given currency to another given currency.
- rate_of_return: service that allows to get the time-weighted rate of return by day from given source and exchanged currency of a given amount since a given start date.
- providers: in order to get the exchange rates, it is needed to get it from external providers.
- users: all the managing of users was made thanks to the cookie-cutter, so we won't go further on it.
To access the api:
- Once the app is running and having a superuser created, go to 0.0.0.0:8000/api/docs
- Execute the endpoint
/auth-token
(selectingapplication/json
as type of payload) with the email and password. Copy the token given - Click on any padlock symbol to authorize every request. On the text box put the prefix
token
followed by the token that you previously copied - Execute any endpoint following the instructions (is given) on each endpoint.
This test was made taking into consideration only local environment (not production) due to time limitations. The production docker-compose file was generated through cookie-cutter, but was not modified/adapted to this project.
This project includes a Continuous Integration (CI) pipeline using "GitHub Actions" that ensures every time a commit is done, it will execute the tests. The CI setup guarantees the reliability and stability of the codebase.
You can find more details about the CI pipeline in the GitHub ci yml file