Applifting Python task
Welcome to the Applifting Python task! To begin, please follow the steps below:
- Go through the assignment brief and read the requirements
- Request access to our service below
- Have fun :)
- Let us know once you're done
Access details
Please enter your email below. We will generate a refresh token for your application.
Hint: In case you lose the token, just enter the email that you entered before! :)
Assigment - Product aggregator microservice
Create a REST API Python microservice which allows users to browse a product catalogue and which automatically updates prices from the offer service, provided by us:
Requirements
- Provide an API to create, update and delete products.
- Periodically query the provided microservice for offers.
- Provide an API to get product offers.
Data model
Product - corresponds to some imaginary product that you can buy.
id - UUID
name - string
description - string
A product has many offers.
Offer - represents the product being offered for some price.
id - UUID
price - integer
items_in_stock - integer
Each offer belongs to one product.
Specification
Must haves:
- Use an SQL database as an internal data store.
- Authenticate with the offers microservice.
- Your refresh token is tied to your email and never expires - you only need one.
- Turn your refresh token into access tokens via the auth endpoint.
- Be careful - access tokens expire. You will need to request them periodically.
- To authenticate your requests, use a
Bearer: <access-token> header.
- Create CRUD for products.
- For all products created in your application, call the offers microservice to register them.
- Your API does not need authentication.
- Create a background service which periodically calls the offers microservice and requests offers for your products.
- Offers are updated periodically and eventually sell out. See the
items_in_stock attribute.
- Once an offer sells out, it disappears.
- New offers can appear at any time.
- Create a read-only API for product offers.
- Base URL for the offers microservice should be configurable via an environment variable.
- Write basic tests for your application using
pytest.
- Add a README with information on how to run & use your service.
- Push your solution into a git repository (GitHub, GitLab, ...) and give us access.
You can earn extra points for:
- Implement simple authentication in your API (e.g. access-token).
- Consider adding some reasonable error handling to the API layer.
- Provide a
Dockerfile and docker-compose.yml for your application.
- Use reasonable dependency management (
requirements.txt, Pipenv, Poetry, ...).
- Deploy your application and make it accessible online.
- Use a hosting service of your choice.
- For example render.com offers a free tier.
- Track the history of offer prices.
- Compute the trend in offer prices. For each product, compute the percentual rise / fall in price for a chosen period of time.
- Create an endpoint to make this information accessible.
That's it! Good luck, and most importantly, have fun!