Service | Service Name | Port |
---|---|---|
postgres | toroto_postgres | 5432 |
backend | toroto-challenge_backend | 8000 |
frontend | toroto-challenge_frontend | 3000 |
- Install docker https://www.docker.com/get-docker
- Install docker-compose https://docs.docker.com/compose/install/
- cd into root directory
- Build and start all services
docker-compose up --build
- Apply all initial migrations
docker-compose run backend python manage.py migrate
- Go to http://localhost:3000/
-
Build all services
docker-compose build
-
Start all services
docker-compose up
-
Stop all services
docker-compose stop
-
Open the shell
docker-compose exec backend /bin/sh
-
Register as an user:
- url: https://secret-shelf-40223.herokuapp.com/api/v1/users/staff/register/
- method: POST
- body: (Select raw and JSON options)
{ "email": "your email", "password": "your password", "first_name": "your first name", "last_name": "your last name" }
-
Copy the auth token from the response
-
Create a new request for subscribers list:
- header:
Key = Authorization
value = Token {paste_token}
- url: https://secret-shelf-40223.herokuapp.com/api/v1/subscribers/
- method: GET
- header:
-
Register staff user
- url: https://secret-shelf-40223.herokuapp.com/api/v1/users/staff/register/
- method:
POST
- Authentication: non required
- body:
{ "email": "your email", "password": "your password", "first_name": "your first name", "last_name": "your last name" }
-
Retrieve, update and destroy staff user
- url: https://secret-shelf-40223.herokuapp.com/api/v1/users/
- method:
GET/PATCH/DELETE
- Authentication: required
- body:
{ "email": "your updated email", "first_name": "your updated first name", "last_name": "your updated last name" }
-
User Login
- url: https://secret-shelf-40223.herokuapp.com/api/v1/users/login/
- method:
POST
- Authentication: required
- body:
{ "email": "your email", "password": "your password" }
-
Retrieve subscribers list
- url: https://secret-shelf-40223.herokuapp.com/api/v1/subscribers/
- method:
GET
- Authentication: required
-
Create new subscriber
- url: https://secret-shelf-40223.herokuapp.com/api/v1/subscribers/new/
- method:
POST
- Authentication: required
- body:
{ "email": "subscriber's email", "first_name": "subscriber's first name", "last_name": "subscriber's last name", "co2_tons_per_year": "10.00" }
-
Retrieve, update and destroy subscriber
- url: https://secret-shelf-40223.herokuapp.com/api/v1/subscribers/{subscriber_id}/
- method:
GET/PATCH/DELETE
- Authentication: required
- body:
{ "email": "ssubscriber's updated email", "first_name": "subscriber's updated first name", "last_name": "subscriber's updated laste name", "co2_tons_per_year": "9.00", "has_subscription": true, "subscription": { "monthly_fee": "6.00", "co2_tons_per_month": "0.40" } }
Note: The has_subscription=true is required in order to update the subscription.
-
Create new subscription
- url: https://secret-shelf-40223.herokuapp.com/api/v1/subscriptions/
- method:
POST
- Authentication: required
- body:
{ "subscriber_id": "subscriber's id" }