Code Monkey home page Code Monkey logo

flight-booking-application's Introduction

flight-booking-application

Build Status Coverage Status

TECHNOLOGIES USED

  • Python3.6: Python is a programming language that lets you work quickly and integrate systems more effectively
  • Django 2.2: Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
  • Django REST framework: Django REST framework is a powerful and flexible toolkit for building Web APIs
  • Django REST framework JWT: Django REST framework JWT This package provides JSON Web Token Authentication support for Django REST framework.
  • Django REST Swagger: Django REST Swagger An API documentation generator for Swagger UI and Django REST Framework.
  • Postgresql: PostgreSQL is a powerful, open source object-relational database system.
  • Pipenv: Pipenv is a tool that aims to bring the best of all packaging worlds (bundler, composer, npm, cargo, yarn, etc.) to the Python world.
  • Psycopg2: Psycopg is the most popular PostgreSQL adapter for the Python programming language.

API Documentation

Visit the links below for the API documentation

CoreApi Documentation

Live API

Vist this Link for the live application.

SETTING UP THE PROJECT

Clone the project

$ https://github.com/PatrickCmd/flight-booking-application.git
$ cd flight-booking-application

Active the virtual environment

$ pip install pipenv
$ pipenv shell

Install the requirements

$ pipenv install

SETTING UP THE DATABASE

Execute the commands in the terminal/console as stated below

ON WINDOWS

Follow the Link on how to download and install postgres(>=10) on windows platform

Create Database

$ psql -U postgres
$postgres# CREATE DATABASE {dbname};  Where dbname is the database name

Setup Database URL environment variable

$ Rename env.example to .env and change the content as per your development settings

ON MAC/UBUNTU

Install postgres

MAC Users

$ brew install postgres

Follow the link on how to setup brew if not yet installed

Ubuntu users

Follow the Link on how to setup and install postgres(>=10) on Ubuntu-linux platform

Create Database

$ psql -U postgres
$ postgres# CREATE DATABASE {dbname};  Where dbname is the database name

Setup Database URL environment variable

$ Rename env.example to .env and change the content as per your development settings

Run database migrations and create superuser

$ python manage.py migrate
$ python manage.py createsuperuser

Run the server

$ python manage.py runserver_plus

Execute the url localhost:8000/ in your browser

Run tests

Execute this command at the terminal

$ python manage.py test

TESTING THE API

API URL ENDPOINTS

Register users: Methods['POST'] http://localhost:8000/fbs-api/users/

{   "email": "[email protected]",
    "password": "Example1234#",
    "date_of_birth": "1900-11-19",
    "first_name": "Example",
    "middle_name": "",
    "last_name": "Example Last",
    "gender": "m",
    "location": "Kyebando",
    "phone": "256786893374"
}

Login user: Methods['POST'] http://localhost:8000/fbs-api/users/login/

{	
    "email": "[email protected]",
    "password": "Example234#"
}

Create user profile: Methods['POST'] Authorization JWT-TOKEN token http://localhost:8000/fbs-api/profiles/

{	
    "using_country": "KENYA",
    "country_of_citizenship": "KENYA",
    "passport_number": "K510192823",
    "issue_date": "2018-08-08",
    "expiration_date": "2028-08-08",
    "passport_photo": ""
}

Profile Details: Methods['GET', 'PUT/PATCH', 'DELETE'] Authorization JWT-TOKEN token http://localhost:8000/fbs-api/profiles/4/

Upload passport photo: Methods['POST'] Authorization JWT-TOKEN token http://localhost:8000/fbs-api/profiles/4/

Form data
{
    'passport_photo': 'file.png or file.jpg'
}

Create Flight Admins[Superusers] only: Methods['POST'] Authorization JWT-TOKEN token http://localhost:8000/fbs-api/flights/

{
    "name": "Entebbe to Denver",
    "origin": "Entebbe",
    "destination": "Denver",
    "departure": "2019-08-02T08:00:00Z",
    "arrival": "2019-08-03T07:00:00Z",
    "aircraft": "Vintage",
    "status": "ON_TIME",
    "number": "KPQYWT72839",
    "capacity": 120
}
Flight Details Admins[Superusers] only: Methods['PUT', 'DELETE'] Authorization JWT-TOKEN token http://localhost:8000/fbs-api/flights/<id>
{
    "name": "Entebbe to Denver",
    "origin": "Entebbe",
    "destination": "Denver",
    "departure": "2019-08-02T08:00:00Z",
    "arrival": "2019-08-03T07:00:00Z",
    "aircraft": "Vintage",
    "status": "ON_TIME",
    "number": "KPQYWT72839",
    "capacity": 120
}

Get flight: Methods['GET'] Authorization JWT-TOKEN token http://localhost:8000/fbs-api/flights/<id>

Make Reservation: Methods['POST'] Authorization JWT-TOKEN token http://localhost:8000/fbs-api/flights/<id>/reservation

{
    'seat': 'A6'
}

See Reservation: Methods['GET'] Authorization JWT-TOKEN token http://localhost:8000/fbs-api/flights/<id>/reservation/<id>

Cancel Reservation: Methods['PATCH'] Authorization JWT-TOKEN token http://localhost:8000/fbs-api/flights/<id>/reservation/<id>/cancel

Number of Reservation on given day for a given flight: Methods['GET'] Authorization JWT-TOKEN token http://localhost:8000/fbs-api/reservations/<flight_pk>/count/<date>/

flight-booking-application's People

Contributors

patrickcmd avatar

Watchers

James Cloos avatar  avatar  avatar

Forkers

scott45

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.