This feature will give users the ability to leave feedback for each other. When they are considering a ride with a particular person (or people) they can simply go to particular user's profile and see all Reviews that were left for that user. The fields each Review will contain are: _id - provided by Mongodb, rating, comment, timestamp- set automatically, user id, way id, and reviewed user id.
{
rating: { type: Number, required: true },
comment: { type: String, required: false },
timestamp: { type: Date, required: true, default: Date.now },
profileID: { type: Schema.Types.ObjectId, required: true },
wayID: { type: Schema.Types.ObjectId, required: true},
reviewedprofileID: { type: Schema.Types.ObjectId, required: true }
}This endpoint will allow user to leave reviews for people with whom he/she just shared a ride, one at a time. Only signed in and authorized users can perform this operation.
There are two properties a user will be able to add to a review body:
- rating
- comment
They may choose to provide both or only submit a rating, which is allowed by our model.
Will send a new Review to the database and update a reviews property on the reviewed user's profile.
To have access to this endpoint a user will need to be signed in and choose a user they wish to see reviews for, the Reviews will then be pulled from that user's profile.
Will look for the data for a particular way and must contain an _id for the user being reviewed.
Will return all reviews left for a particular user.
This endpoint will allow a user to edit a Review they previously left for a user. Only signed in and authorized users will be able to perform this operation.
A rating and a comment will be sent in the req.body, where req.body.rating is required and req.body.comment is optional.
An updated Review with an updated res.body will then be sent to the database.
This endpoint will allow an authorized user to delete a Review they've previously written.
The request needs to contain an _id for that Review.
Will return a 204 status to confirm a successful deletion.