This app contains 2 types of components:
- Drivers
- Users
- I have assumed that both User and Driver can rate each other anything from 0 to 5 (Floating Point Numbers Included)
- All users and drivers start with 0 rating.
- The average of all rides is the current rating of the driver.
- Any user or driver can signup using a unique 10 digit mobile number. (One number can be used to sign up as driver and user both)
To solve this problem, I have taken 2 types of users.
- Driver
- User (Can also be called rider)
After each ride, both the user and the driver have the option to rate each other. Both the rider and user have a current rating which can go up or down according to the other person's rating. All ratings given by users to a driver are saved in an array and the same applies to each driver's rating as well.
I have used a MongoDB database with 2 collections, Driver and User. Both are identical collection that contain -
- Name
- Phone Number
- Current Ratings
- Number of Trips
- All ratings given to the person (Both Users and Drivers)
- Clone or unzip the app.
- run the command
npm install
. - Create a .env file and provide a field MONGOADDRESS
- Run
npm run start
.