example workflow codecov

Users Groups System (backend part)

Frontend part of the system you can find here.


Description

This is a simple REST API that provides endpoints to make CRUD requests to work with users and groups. Also users can be added to the different existing groups because the many-to-many relationship exists in the database between Users and Groups tables.

Used technologies

  • Django + Django REST Framework
  • PostgreSQL
  • Docker + Docker Compose
  • Pytest + Coverage

  • Requirements

    Before running the application on your machine you need to have docker and docker-compose installed. The installation guide you can find here.
    Also you need to add .env and .env.db file to the root directory of the project.
    Example of .env file:
    
    TIME_ZONE=Europe/Kiev #your timezone
    DEBUG=True 
    SECRET_KEY='your-secret-key'
    
    Example of .env.db file:
    
    POSTGRES_DB=ugs_db
    POSTGRES_USER=postgres
    POSTGRES_PASSWORD=1111
    POSTGRES_HOST=ugs_database #this parameter must be the same because it refers to the docker container where the database will be running
    POSTGRES_PORT=5432
    
    

    How to run application

    To run application and its database in docker containers (you can add -d flag to run them in background)
    docker-compose up 
    
    To stop and remove the docker containers where the application and its database run
    docker-compose down
    

    How to run tests

    To run tests you have to create a virtual environment where all needed packages will be installed. Create virtual environment with the following command (provided example for the Linux OS):
    python3 -m venv venv
    
    Then activate it:
    source venv/bin/activate
    
    Install all packages from requirements.txt file:
    pip install -r requirements.txt
    
    Run tests with PyTest:
    pytest
    

    Postman collection

    The Users-Groups-System.postman_collection.json file stores the Postman collection with examples of all requests which can be sent to the running application. To try these requests import this collection into your Postman application.