We want to build a cab booking platform to allow a rider to book a cab.
90 minutes
- The location is represented as a (x, y) coordinate.
- Distance between two points (x1, y1) and(x2, y2) is sqrt((x1-x2)^2 + (y1-y2)^2)
- Platform has decided upon maximum distance a driver has to travel to pickup a rider.
- A cab has only 1 driver.
- Sharing of cab is not allowed between riders
- There is a single type of cab
- Register a rider.
- Register a driver/cab
- Update a cab's location
- A driver can switch on/off his availability
- A rider can book a cab
- Fetch history of all rides taken by a rider.
- End the Trip
- Demonstrable code is first expectation. To do this, you can choose any interface you are comfortable with - CLI, WebApp, MobileApp, APIs or even simply run the code via Tests or a main method.
- Code should be extensible.
- Clean professional level code.
- Functional Completeness including good modelling.
- User Identification but not authentication.
- Backend Database is optional. However modelling should be complete.
Clone this repository and run the code.
- Django 2.3
- Python 3
- MySQL 5.7
- Postman
- Create a virtual environment with Python 3. Activate it.
- Install dependencies from requirements.txt file
- Clone code.
- Create database. Migrate.
- Run server.
- Use postman collection to test endpoints.
curl --location --request POST 'localhost:8000/rider/register/' \
--form 'mobile=3434343434' \
--form '[email protected]' \
--form 'name=rider1' \
--form 'address=noida'
curl --location --request POST 'localhost:8000/driver/register/' \
--form 'mobile=666666661' \
--form 'vehicle_number=dl2can3333' \
--form 'name=driver3' \
--form 'address=Delhi'
curl --location --request POST 'localhost:8000/cab/location/update/' \
--form 'driver_id=1' \
--form 'x=20' \
--form 'y=10' \
--form 'is_available=True'
curl --location --request POST 'localhost:8000/rider/cab/book/' \
--form 'rider_id=1' \
--form 'x=10' \
--form 'y=20'