Skip to content

The Airtech-API is the backbone of a flight booking application where users can make flight reservations and buy flight tickets.

License

Notifications You must be signed in to change notification settings

veeqtor/Airtech-API

Repository files navigation

Airtech-API

CircleCI Maintainability Test Coverage

Description

The Airtech-API is the backbone of a flight booking application where users can make flight reservations and buy flight tickets.

The API documentation can be found here: Doc

Staging Link: Staging Link

Key Application features

  1. Register and login users.
  2. Be a vendor and sell wears.
  3. Users can upload passport photographs.
  4. Users can book tickets.
  5. Users can receive tickets as an email.
  6. Users can check the status of their flight.
  7. Users can make flight reservations.
  8. Users can purchase tickets.

Table of Contents

Getting Started

This is a python API built with Django v2.2 and Django Rest Framework framework. Authentication of users is done via JSON Web Tokens.

Technologies

Setting up Development With Docker

  1. Download Docker from here
  2. Set up an account to download Docker
  3. Install Docker after download
  4. Go to your terminal run the command docker login
  5. Input your Docker email and password

To setup for development with Docker after cloning the repository please do/run the following commands in the order stated below:

  • cd <project dir> to check into the dir
  • docker-compose build to build the application images
  • docker-compose up to start the api after the previous command is successful

The docker-compose build command builds the docker image where the api and its postgres database would be situated. Also this command does the necessary setup that is needed for the API to connect to the database.

The docker-compose up command starts the application.

To stop the running containers run the command docker-compose down To delete the database volume as well run the command docker-compose down -v

To Clean Up After using docker do the following

  1. In the Docker_local directory, run the command sh cleanup.sh
  2. Wait for all images to be deleted.

URGENT WARNING PLEASE DO NOT RUN THE CLEAN-UP COMMAND ABOVE UNLESS YOU ARE ABSOLUTELY SURE YOU ARE DONE WITH THAT DEVELOPMENT SESSION AND HAVE NO DATA THAT WOULD BE LOST IF CLEAN-UP IS DONE!

Setting up for development

NOTE: This setup is for MacOS only, Windows setup will be coming soon.
  • Check that python 3 is installed:

    python --v
    >> Python 3.7
  • Install pipenv:

    brew install pipenv
  • Check pipenv is installed:

    pipenv --version
    >> pipenv, version 2018.11.26
  • Check that postgres is installed:

    postgres --version
    >> postgres (PostgreSQL) 10.5
  • Clone the Airtech-API repo and cd into it:

    git clone https://github.com/veeqtor/Airtech-API.git
  • Install dependencies:

    pipenv install
    
  • Install dev dependencies to setup development environment:

    pipenv install --dev
  • Rename the .env.sample file to .env and update the variables accordingly:

  • Activate a virtual environment:

    pipenv shell
  • Apply migrations and create a superuser:

    python manage.py migrate  && python manage.py createsuperuser
  • Run the application:

    python manage.py runserver
  • Should you make changes to the database models, run migrations as follows:

    python manage.py makemigrations && python manage.py migrate
  • Deactivate the virtual environment once you're done:

    exit

Running tests and generating report

On command line run:

pytest

To further view the lines not tested or covered if there is any,

An htmlcov directory will be created, get the index.html file by entering the directory and view it in your browser.

Running Celery worker

  • Running Redis server : if you are not running docker, then you can simply run the command sh redis.sh in the root project directory, this will install redis for you (if not already installed) and also run/start the redis server for the first time on your local machine.

    • Update the .env with the redis info, this is usually localhost and 6379:

      REDIS_HOST=<redis_host>
      REDIS_PORT=<redis port>
      
    • In a new terminal tab run the Celery Message Worker with:

      celery worker -A src.celery -l info --concurrency=2
      

Running Celery beat

  • After setting up the Celery worker, you need to start the celery-beat used to to trigger celery scheduled tasks

  • In a new terminal tab start celery-beat with:

    celery -A src.celery beat -l info --scheduler django_celery_beat.schedulers:DatabaseScheduler --pidfile=/tmp/celeryd.pid
    

Running Celery flower

  • After setting up the Celery workers and beat, you need to start the celery-flower used to monitor celery task in realtime.

  • In a new terminal tab start celery-flower with:

    celery flower -A src.celery --address=0.0.0.0 --port=5555
    

Contribution guide

Contributing

All proposals for contribution must satisfy the guidelines in the product wiki. When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.This Project shall be utilising a Pivotal Tracker board to track the work done.

License

This project is authored by Nwokeocha victor and is licensed for your use, modification and distribution under the MIT license.

About

The Airtech-API is the backbone of a flight booking application where users can make flight reservations and buy flight tickets.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •