anatolio-deb / sellspoint

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

README

Dependencies

Run local development environment

Clone this repository:

git pull https://github.com/anatolio-deb/sellspoint

Create a virtual environment:

python3 -m venv venv

Activate a virtual environment:

source ./venv/bin/activate

Install dependencies:

pip install -r requirements.txt

Apply the migrations:

python manage.py makemigrations && python manage.py migrate

Run the local development server:

python manage.py runserver

Querying an API

The API comes with two REST endpoints available.

The Sells Point endpoint

  • URL: /api/sell-points/
  • Methods available: GET
  • Accepts: a phone_number data field for an authorisation purposes
  • Returns: a list of Sell Points by an existing Worker(User)

Statuses

  • 400 — The request is missing a phone_number field
  • 404 — There’s no a Worker instance with a phone_number field coming in the request

The Visits endpoint

  • URL: /api/visits/
  • Methods available: POST
  • Accepts: a phone_number data field for an authorisation purposes, pk of the Sells Point instance, longitude and latitude data fields
  • Returns: pk of created Visit instance and the time field

Statuses

  • 400 — The request is missing a phone_number field
  • 404 — There’s no a Worker instance with a phone_number field coming in the request
  • 201 — The Visit instance is created

About


Languages

Language:Python 100.0%