Skip to content

aksharanigam1112/Movie-Ticket-Booking-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Movie Ticket Booking System

A REST API interface for booking tickets

Assumptions :-

  • A maximum of 20 tickets can be booked.
  • A ticket is marked expired if there is a difference of 8 hours or more between the ticket timing and current time.
  • A user can book more than 1 seat and has to provide the seat numbers too.

Installing Libraries :-

pip install -r requirements.txt

Run the code :-

export FLASK_APP=ticket.py
flask run

Database Structure :-

{
    "ticketID" : 1,
    "name" : "XYZ",
    "phn" : 1234567890,
    "time" : "15:00",
    "date" : "2020-09-01",
    "tickets" : 2,
    "seats" : ["A1","A2"]
}

   ticketID : It's a primary key assigned to each booking
   name : Name of the user who is booking the ticket
   phn : Phone Number of the user
   time : Time slot of the movie
   date : Date for which the user wants to book the seats
   tickets : Number of tickets the user is booking
   seats : Seat numbers the user wishes to book

API Calls & Screenshots :-

GET Request ===> http://127.0.0.1:5000/ ===> {'msg' : 'Welcome to Ticket Booking System', 'status' : 200}

Initial Call to the API

Home

POST Request ===> http://127.0.0.1:5000/book ===> {'msg' : 'Booked successfully', 'status' : 200}

To book a Ticket the user provides name, phone number, time, date, number of tickets to be booked and seat numbers. After which a ticket ID is alloted to the user. If an exception is raised the API returns with status code 400 

Booking Ticket

Database View

GET Request ===> http://127.0.0.1:5000/view/<ticket_id> ===> {'info' : ticketInfo, 'status' : 200}

To view a ticket information for the given ticket ID. If an exception is raised the API returns with status code 500

Viewing a particular Ticket

GET Request ===> http://127.0.0.1:5000/view ===> {'AllTickets' : data, 'status' : 200}

To view All the tickets at a particular time. If an exception is raised the API returns with status code 500

View all tickets

PUT/PATCH Request ===> http://127.0.0.1:5000/update ===> {'msg' : 'Updated successfully', 'status' : 200}

To update the time of a booked ticket. If an exception is raised the API returns with status code 500.

Update time of a ticket ID

Database Change after updation

DELETE Request ===> http://127.0.0.1:5000/delete/ ===> {'msg' : 'Deleted successfully', 'status' : 200}

To delete a ticket for a given user name. If an exception is raised the API returns with status code 500.

Delete a ticket

Database Change after deletion

Expired Tickets Handling

    To mark the expired tickets a background scheduling is done.

Scheduler

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages