Problem statement

Develop a parking lot application where we should be able to perform the following operations:

  1. A Parking manager can create parking lots with desired parking slots in each parking lot.

  2. The user (Vehicle owner) can choose any parking lot & can park his vehicle in the nearest parking slot available in that lot (e.g. if parking slots are numbered 1,2,3....n, then we still start from 1 and pick the available one if it’s not in maintenance mode or already parked).

  3. When the user unparks, the response should be successful along with the parking fee that will be calculated as Rs. 10 * the Number of ceiled hours the vehicle has been parked. eg If parked for 1 hour 5 minutes, it will be 10 * 2 = 20

  4. Parking manager can view his current parking lot status (eg which cars are parked in which slots)

  5. The Parking Manager should be able to get the total number of vehicles parked on any day, total parking time and the total fee collected on that day.

  6. The parking manager can put any parking space/slot into maintenance mode and back to working state at any time.

Links:

Github Repository

Postman Workspace

Endpoints

1.Create A Parking Lot: POST /parking-lots/:id/slot 2.Park Vehicle, POST /parking-lots/:id/park 3.Unpark Vehicle, POST /parking-lots/:id/unpark 4.Get Parking Lot Status, GET /parking-lots/:id/status 5.Daily Report, GET /parking-lots/:id/report/:date (e.g., /parking-lots/123/report/2023-11-22)

Database Design

parking_lots               slots                               vehicles
--------------------------------------------------------------------------------
id                         id                                     id
uuid                       uuid                                   uuid
name                       parking_lot_id                   registration_number
slot_number                slot_id
is_available               parked_at
is_maintenance             unparked_at

Relationships

Indexes