orchidtexture / toroto-challenge

Home Page:https://secret-shelf-40223.herokuapp.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

toroto-challenge Docker Compose

Service Service Name Port
postgres toroto_postgres 5432
backend toroto-challenge_backend 8000
frontend toroto-challenge_frontend 3000

Setting everything up

  1. Install docker https://www.docker.com/get-docker
  2. Install docker-compose https://docs.docker.com/compose/install/
  3. cd into root directory
  4. Build and start all services docker-compose up --build
  5. Apply all initial migrations docker-compose run backend python manage.py migrate
  6. Go to http://localhost:3000/

Basic Usage

  • 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

API Usage Example

  1. Register as an user:

    {
        "email": "your email",
        "password": "your password",
        "first_name": "your first name",
        "last_name": "your last name"
    }

    register example

  2. Copy the auth token from the response

  3. Create a new request for subscribers list:

    subscribers list example

Endpoints

  1. Register staff user

    {
        "email": "your email",
        "password": "your password",
        "first_name": "your first name",
        "last_name": "your last name"
    }
  2. Retrieve, update and destroy staff user

    {
        "email": "your updated email",
        "first_name": "your updated first name",
        "last_name": "your updated last name"
    }
  3. User Login

    {
        "email": "your email",
        "password": "your password"
    }
  4. Retrieve subscribers list

  5. Create new subscriber

    {
        "email": "subscriber's email",
        "first_name": "subscriber's first name",
        "last_name": "subscriber's last name",
        "co2_tons_per_year": "10.00"
    }
  6. Retrieve, update and destroy subscriber

    {
        "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.

  7. Create new subscription

    {
        "subscriber_id": "subscriber's id"
    }

About

https://secret-shelf-40223.herokuapp.com/


Languages

Language:JavaScript 57.2%Language:Python 36.6%Language:Dockerfile 2.6%Language:HTML 1.9%Language:CSS 1.0%Language:Shell 0.7%