Skip to content

Django REST framework приложение, с переопределённым пользователем и списком организаций в которых он состоит

Notifications You must be signed in to change notification settings

ApostL78/orgs_api

Repository files navigation

orgs_api Django CI codecov

Django REST framework приложение, с переопределённым пользователем и списком организаций в которых он состоит

How It Works

To implement ManyToMany relationship between user and organization we need 3 tables: user, organization and table with keys

models diograms

  1. There is an endpoint for user creation (registration), listing all users with list of organizations called users (http://127.0.0.1:8000/api/users/) methods: GET, POST

Also to get user by ID add his id to the end of url (.../1/) (Anyone can GET info, but only owner can edit by PUT or PATCH) 2) For listing all organizations with their users we have an endpoint organizations (http://127.0.0.1:8000/api/organizations/) methods: GET, POST

Make POST request to endpoit token (http://127.0.0.1:8000/api/token/) to get access token for authentication and then use it in headers (key: Authentication value: Bearer ACCESS_TOKEN)

For more complex documentation visit swagger or redoc page when server is running

How To Run

To start this app you need to:

  1. Clone this repo and move to project
git clone https://github.com/ApostL78/orgs_api.git && cd orgs_api
  1. Create and activate venv
python3 -m venv venv && source ./venv/bin/activate
  1. Create environment variables
cp .env.example .env

and then put your values

  1. Install all requirements
pip install -r requirements.txt
  1. Migrate and run server
python3 manage.py migrate && python3 manage.py runserver

After the server starts, navigate to http://localhost:8000/swagger/ in your web browser

About

Django REST framework приложение, с переопределённым пользователем и списком организаций в которых он состоит

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages