Giter VIP home page Giter VIP logo

irctc_booking_system's Introduction

IRCTC Booking System (WorkIndia Assignment)

I have completed this interesting assignmend given by Workindia. Worked well on each required statement of the assignment.

  • Implement JWT Authentication for User Authentication
  • API key Authentication for the Admin Site (Add header X-IRCTC-API-KEY-SECRET in the All admin API's)
  • Handles race conditions while booking
    • If more than 1 users simultaneously try to book seats, only either one of the users should be able to book (By adding database lock)
  • Focused on code quality and vaidation

Assumptions

  • Train is running only between source and destination

Tech Stack Used

  • Python
  • Django
  • MySQL

Steps To Setup Project

First clone the github repository

  git clone https://github.com/nmastepankaj/irctc_booking_system.git

Open the repository folder in any code editor (VS code) or open any terminal.

You need to create virtual environment for the project. If you don't have virtualenv the install it using the below command :-

  virtualenv venv

Now, activate the virtual environment using the below command. If you're window user :-

  ./venv/Scripts/activate

If you're linux user :-

  source venv/bin/activate

install all the project requirements

  pip install -r requirement.txt

Now, you need to create migrations and migrate all the migrations

  python manage.py makemigrations
  python manage.py migrate

Create super user for your project

  python manage.py createsuperuser

Run your project

  python manage.py runserver

Now your application is ready to use. First register a user and login with the provided credentials.

To access the Admin API you need to create token ( using function generate_api_key present in utils/token.py) and add to the db AdminSecret manually. To access the user API you need to register then login where you get the access token. Then you this token for user api which starts with /api/user/

API Endpoints

The app defines following CRUD APIs.

POST /api/public/account/register

POST /api/public/account/login

POST /api/user/booking/book_ticket

GET /api/user/booking/get_trains

GET /api/user/booking/get_booking/{booking_uuid}

POST /api/admin/booking/add_train

POST /api/admin/booking/add_train_schedule

PATCH /api/admin/booking/update_train_schedule/{schedule_id}

Screenshots of the working API

  • Login User Screenshot (1008)

  • Register User Screenshot (1007)

  • Book Ticket API Screenshot (1009)

  • Get train between source and destination Screenshot (1010)

  • Get Booking Details Screenshot (1011)

  • Add Train Screenshot (1012)

  • Add Train Schedule Screenshot (1013)

  • Update Train Schedule Screenshot (1014)

irctc_booking_system's People

Contributors

nmastepankaj avatar

Watchers

 avatar

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.