Skip to content

Latest commit

 

History

History
189 lines (175 loc) · 4.95 KB

readme.md

File metadata and controls

189 lines (175 loc) · 4.95 KB

Ticket Torque Backend API

Client Requirements

As a guest user, I can

  • View homepage, Schedules
  • Signup to buy tickets
  • Search for ticket from one destination to another
  • Select ticket of what category(Bus,Train,Plane) I want.

As an Admin user, I can

  • Login
  • View & edit profile(first_name,last_name,email,password)
  • CRUD Users
  • CRUD roles(only 2 roles: admin,customer)
  • CRUD Tickets
  • Logout

As a Customer, I can

  • Login
  • View & edit profile(first,last name,email,password)
  • Purchase a Ticket if available.
  • Cancel purchase.
  • See my purchase history
  • Checkout -

Technology

  • Language: Python3
  • Framework: Django
  • Database: PostgreSQL

Database Models

Database Model Image

Screenshots

  • Home Image
  • Ticket List Image
  • Checkout Image
  • History Image
  • Profile Image
  • Login Image
  • Register Image

API Routes

  • To register - POST
/api/user/register
  • To login : will get and jwt token. - POST
/api/user/login
  • To Logout - will logout user/admin - GET
/api/user/logout
  • Get all user list : secured, authorized to admin only - GET
/api/user/all
  • Get individual user details : secured, only authorized admin and user himself and access it - GET
/api/user/{id}
  • Update user information : secured, only authorized admin and user himself and access it - PUT
/api/user/update/{id}
  • Update user role : only authorized admin can do it - PUT
/api/user/update/role/{id}
  • Delete a user : secured, only authorized admin and user himself and access it - DELETE
/api/user/delete/{id}
  • Get all vehicle list : everyone can access it - GET
/api/vehicle/all
  • Get individual vehicle details : everyone can access it - GET
/api/vehicle/{id}
  • Add new vehicle : Only authorized admin can do it - POST
/api/vehicle/add-new
  • Update vehicle : Only authorized admin can do it - PUT
/api/vehicle/update/{id}
  • Delete vehicle : Only authorized admin can do it - DELETE
/apu/vehicle/delete/{id}
  • Get all category list : everyone can access it - GET
/api/category/all
  • Get individual category details : everyone can access it - GET
/api/category/{id}
  • Add new category : Only authorized admin can do it - POST
/api/category/add-new
  • Update category : Only authorized admin can do it - PUT
/api/category/update/{id}
  • Delete category : Only authorized admin can do it - DELETE
/apu/category/delete/{id}
  • Get all location list : everyone can access it - GET
/api/location/all
  • Get individual location details : everyone can access it - GET
/api/location/{id}
  • Add new location : Only authorized admin can do it - POST
/api/location/add-new
  • Update location : Only authorized admin can do it - PUT
/api/location/update/{id}
  • Delete location : Only authorized admin can do it - DELETE
/apu/location/delete/{id}
  • Search for ticket : everyone can access it, will have pagination - GET
api/ticket/all?category_id=123e4567-e89b-12d3-a456-426614174000&vehicle_id=123e4567-e89b-12d3-a456-426614174001&from=123e4567-e89b-12d3-a456-426614174002&to=123e4567-e89b-12d3-a456-426614174003&page=2

  • Get individual ticket details : everyone can access it- GET
/api/ticket/{id}
  • Add new Ticket : only authorized admin can do it - POST
/api/ticket/add-new
  • Update Ticket : only authorized admin can do it - PUT
/api/ticket/update/{id}
  • Delete Ticket : only authorized admin can do it - DELETE
/api/ticket/delete/{id}
  • Buy a ticket : only logged-in user can do it,we will only send the transaction id,user id : POST
/api/ticket/buy/{ticket_id}
  • Cancel purchase : only user himself and admin can do it : PUT
/api/ticket/cancel/{ticket_id}
  • Show purchase history : only admin and user himself can do it : POST
/api/user/{id}/purchase-history
  • Download ticket pdf : only tickets whose payment status is SUCCESS can be downloaded by authorized user - GET
/api/download/ticket/{ticket_id}/user/{user_id}

How to Build and Run