Coder Social home page Coder Social logo

cargo-api's Introduction

Cargo API service instruction

Установка и запуск приложения

  • Клонируйте репозиторий
    git clonehttps://github.com/CHRNVpy/cargo-api.git
  • Перейдите в директорию репозитория
    cd Cargo
  • Создайте Docker контейнер
    docker-compose up
    После сборки контейнера Django сервер запустится автоматически.
    Создайте миграции
  • docker exec <название контейнера> python manage.py makemigrations
  • docker exec <название контейнера> python manage.py migrate
  • Импортируйте данные о локациях
    docker exec <название контейнера> python manage.py import_locations uszips.csv
  • Сгенерируйте транспорт
    docker exec <название контейнера> python manage.py generate cars <количесто машин: int>
  • Сгенерируйте грузы (не обязательно)
    docker exec <название контейнера> python manage.py generate cargo <количесто карго: int>
  • Запустите сервис для автоматического обновления локаций машин каждые 3 минуты (не обязательно)
    docker exec <название контейнера> cron

API ENDPOINTS

BASE URL: https://localhost:8000

Добавление груза

ENDPOINT: POST /api/cargo_add/

Parameters:

  • pick_up_location: Location's zip code (integer)
  • delivery_location: Location's zip code (integer)
  • weight: Weight of the cargo (string)
  • description: Description of the cargo (string)

Example Request Body:

Cargo Add Example Request

Получение списка грузов

ENDPOINT: GET /api/cargo_list/

Parameters: (optional)

  • weight: Weight of the cargo (string)
  • miles_to_cars: Distance in miles to the cars (integer)

Example Response:

Cargo List Example Response

Получение информации о грузе по ID

ENDPOINT: GET /api/cargo/<int:cargo_id>/

Example Response:

Cargo Info Example Response 1 Cargo Info Example Response 2

Обновление локации авто

ENDPOINT: PUT /api/car_update/<int:car_id>/

Parameters:

  • current_location: Location's zip code (integer)

Example Request Body:

Car Update Example Request

Обновление информации о грузе (вес, описание)

ENDPOINT: PUT /api/cargo_update/<int:cargo_id>/

Parameters:

  • weight: Weight of the cargo (integer)
  • description: Description of the cargo (string)

Example Request Body:

Cargo Update Example Request

Удаление груза

ENDPOINT: GET /api/cargo_delete/<int:cargo_id>/

Example Response:

Cargo Delete Example Response

cargo-api's People

Contributors

chrnvpy avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.