Review a listing
Access: Bearer token required.
Creates the caller's review of a property. Each user can review a given property once; a second attempt is a 409. There are no endpoints to edit or delete a review.
The code does not check that the reviewer rented, bought or booked the property, does not stop owners reviewing their own listing, and does not exclude soft-deleted properties. New reviews are stored with verified: false.
Creating a review does not update the property's rating.averageRating / rating.reviewCount; nothing in the service writes those fields, so compute averages from GET /property/{id}/reviews if you need them.
If the property has an agentId and the reviewer is not that agent, the agent is notified (event type agent_review_received): an in-app notification record, a notifications:new socket event, a push notification and an email, subject to the agent's notification preferences. The landlord is not notified.
The route has no request validator; the rules below come from the model, so violations come back as 400 Validation Error: Review validation failed: .... A request with no JSON body at all fails with a 500.
bearerAuthAuthorizationBearer <JWT>Access token returned by sign-in. Send it as Authorization: Bearer <token>.
id*stringObjectId of the property being reviewed. A malformed id produces a 500 with Mongoose's cast error message.
application/json- body
rating*numberOverall rating, 1-5.
title*string5-100 characters.
comment*string20-5000 characters.
categories?Optional sub-ratings, each 1-5: { cleanliness?, communication?, accuracy?, location? }.
Review created. reviewerId is populated with the reviewer's firstName, lastName and avatar.
application/json- response
status*integersuccess*booleanmessage*stringdata*curl -X POST 'http://localhost:4000/api/v1/property/string/reviews' \ -H 'Content-Type: application/json' \ -d '{ "rating": 4, "title": "Clean, quiet and well managed", "comment": "The apartment matched the photos, power was steady and the agent responded quickly whenever we had a question.", "categories": { "cleanliness": 5, "communication": 4, "accuracy": 4, "location": 5 }}'{ "status": 201, "success": true, "message": "Review created successfully", "data": { "_id": "66a1d2e3f4a5b6c7d8e9f012", "propertyId": "665f1c2e9b1d4a0012ab34cd", "reviewerId": { "_id": "664b1c8f3a9d4e0012bb33cc", "firstName": "Aisha", "lastName": "Bello", "avatar": "https://res.cloudinary.com/homelinkhub/image/upload/v1760000000/homelinkhub/media/aisha.jpg" }, "transactionId": null, "rating": 4, "title": "Clean, quiet and well managed", "comment": "The apartment matched the photos, power was steady and the agent responded quickly whenever we had a question.", "categories": { "cleanliness": 5, "communication": 4, "accuracy": 4, "location": 5 }, "verified": false, "helpful": 0, "unhelpful": 0, "createdAt": "2026-11-25T13:20:00.000Z", "updatedAt": "2026-11-25T13:20:00.000Z", "__v": 0 }}