This API provides endpoints for OTP-based user authentication.
http://localhost:4000 for running locally
http://api.planetx-live.com for aws url
This endpoint generates and sends an OTP to the user's mobile number for authentication. The OTP is valid for 5 minutes.
POST
api/auth/send-otp
Content-Type:application/json
{
"mobile": "+91<10-digit-mobile-number>"
}- Replace
<10-digit-mobile-number>with the user’s mobile number prefixed with+91.
{
"mobile": "+919519896860"
}Success:
{
"message": "OTP sent successfully"
}Error Responses:
400 Bad Request: Missing or invalidmobilefield.
Example:{ "message": "Mobile number is required" }500 Internal Server Error: Failure in sending OTP.
Example:{ "message": "Error sending OTP", "error": "<error-details>" }
This endpoint verifies the OTP sent to the user's mobile number. If successful, it generates a JWT token that can be used for subsequent authentication.
POST
api/auth/verify-otp
Content-Type:application/json
{
"mobile": "+91<10-digit-mobile-number>",
"otp": "<4-digit-otp>"
}- Replace
<10-digit-mobile-number>with the user’s mobile number prefixed with+91. - Replace
<4-digit-otp>with the OTP received by the user.
{
"mobile": "+919580884280",
"otp": "3560"
}Success:
{
"message": "Login successful",
"token": "<jwt-token>"
}- Replace
<jwt-token>with the actual JWT token generated by the backend.
Error Responses:
400 Bad Request: Missingmobileorotpfield.
Example:{ "message": "Mobile number and OTP are required" }404 Not Found: Mobile number not found in the system.
Example:{ "message": "User not found" }400 Bad Request: OTP expired.
Example:{ "message": "OTP expired" }400 Bad Request: Invalid OTP.
Example:{ "message": "Invalid OTP" }
-
Mobile Number Format
Ensure the mobile number is prefixed with the country code (+91for India). -
OTP Expiry
The OTP is valid for 5 minutes. Ensure the user submits the OTP before it expires. -
Token Usage
The token provided in the response should be included in theAuthorizationheader for subsequent authenticated requests:Authorization: Bearer <jwt-token>
POST api/properties/add
This API is used to add a new property to the system. It accepts the details of the property, including its type, location, furnishings, amenities, and multimedia content (images and videos).
{
"propertyType": "For Sale",
"category": "Residential",
"location": {
"city": "Mumbai",
"state": "Maharashtra",
"locality": "Andheri",
"subLocality": "Lokhandwala",
"apartment": "ABC Residency",
"houseNumber": "Flat 302"
},
"about": {
"bedrooms": 3,
"bathrooms": 2,
"balconies": 2
},
"propertyArea": {
"carpetArea": 1200,
"builtUpArea": 1400
},
"otherRooms": {
"poojaRoom": true,
"guestRoom": true,
"servantRoom": false,
"studyRoom": true
},
"furnishingStatus": "Fully Furnished",
"furnishingDetails": {
"fans": 5,
"lights": 10,
"tv": 2,
"beds": 3,
"ac": 2,
"wardrobes": 3,
"exhaustFans": 2,
"curtains": 6,
"floorLamps": 2,
"diningTable": true,
"sofa": true,
"stove": true,
"kitchenCabinets": true,
"chimney": true,
"coffeeTable": true,
"refrigerator": true,
"microwave": true,
"dishwasher": false,
"waterPurifier": true,
"washingMachine": true
},
"totalFloors": 10,
"propertyOnFloor": 3,
"flatNumber": "302",
"parking": {
"covered": 1,
"open": 1
},
"availabilityStatus": "Ready to Move",
"availableFrom": "2024-01-01",
"ageOfProperty": 5,
"description": "Beautifully furnished 3BHK apartment in a prime location with all modern amenities."
}{
"message": "Property added successfully",
"property": {
"user": "67555adb6635b9a4fa1b2c7c",
"propertyType": "For Sale",
"category": "Residential",
"location": {
"city": "Mumbai",
"state": "Maharashtra",
"locality": "Andheri",
"subLocality": "Lokhandwala",
"apartment": "ABC Residency",
"houseNumber": "Flat 302"
},
"about": {
"bedrooms": 3,
"bathrooms": 2,
"balconies": 2
},
"propertyArea": {
"carpetArea": 1200,
"builtUpArea": 1400
},
"otherRooms": {
"poojaRoom": true,
"guestRoom": true,
"servantRoom": false,
"studyRoom": true
},
"furnishingStatus": "Fully Furnished",
"furnishingDetails": {
"fans": 5,
"lights": 10,
"tv": 2,
"beds": 3,
"ac": 2,
"wardrobes": 3,
"exhaustFans": 2,
"curtains": 6,
"floorLamps": 2,
"diningTable": true,
"sofa": true,
"stove": true,
"kitchenCabinets": true,
"chimney": true,
"coffeeTable": true,
"refrigerator": true,
"microwave": true,
"dishwasher": false,
"waterPurifier": true,
"washingMachine": true
},
"totalFloors": 10,
"propertyOnFloor": 3,
"flatNumber": "302",
"parking": {
"covered": 1,
"open": 1
},
"availabilityStatus": "Ready to Move",
"availableFrom": "2024-01-01T00:00:00.000Z",
"ageOfProperty": 5,
"description": "Beautifully furnished 3BHK apartment in a prime location with all modern amenities.",
"images": [
{
"name": "house.jpg",
"url": "https://res.cloudinary.com/dtfhslkcx/image/upload/v1733650279/properties/images/hbytqrmeyrzghrqnixij.jpg",
"_id": "675567683c5a4f0318851083"
}
],
"video": "https://res.cloudinary.com/dtfhslkcx/video/upload/v1733650280/properties/videos/gaudnkxkie5ajhdvhre2.mp4",
"_id": "675567683c5a4f0318851082",
"__v": 0
}
}{
"error": "Validation failed",
"message": "Some required fields are missing or incorrect."
}availableFromshould be in the formatYYYY-MM-DDor ISO 8601.- Ensure that the property data such as area, rooms, and furnishings are accurately provided to avoid validation errors.
Here is the updated documentation with the required changes:
This endpoint is used to update an existing property in the database. You can update property details such as images, video, description, and furnishing details.
- propertyId (required): The unique ID of the property to be updated.
- imageId (optional): The unique ID of the image to be updated.
-
propertyData (optional): Updated property data. The data should be sent as a stringified JSON object containing the following fields:
- location: The address details of the property.
- city: The city where the property is located.
- state: The state of the property.
- locality: The locality within the city.
- subLocality: The sub-locality within the locality.
- apartment: The apartment name/building name.
- houseNumber: The house number or flat number.
- about: The number of rooms and facilities in the property.
- bedrooms: The number of bedrooms.
- bathrooms: The number of bathrooms.
- balconies: The number of balconies.
- propertyArea: The area of the property.
- carpetArea: The carpet area of the property.
- builtUpArea: The built-up area of the property.
- otherRooms: The presence of other rooms in the property.
- poojaRoom: Boolean indicating the presence of a pooja room.
- guestRoom: Boolean indicating the presence of a guest room.
- servantRoom: Boolean indicating the presence of a servant room.
- studyRoom: Boolean indicating the presence of a study room.
- furnishingDetails: The details of the furnishings in the property.
- fans, lights, tv, beds, ac, wardrobes, exhaustFans, curtains, floorLamps, diningTable, sofa, stove, kitchenCabinets, chimney, coffeeTable, refrigerator, microwave, dishwasher, waterPurifier, washingMachine: The number or presence of each of these furnishing items.
- parking: The parking details.
- covered: The number of covered parking spaces.
- open: The number of open parking spaces.
- propertyType: The type of property (e.g., "For Sale").
- category: The category of the property (e.g., "Residential").
- furnishingStatus: The status of furnishing (e.g., "Half Furnished").
- totalFloors: The total number of floors in the building.
- propertyOnFloor: The floor on which the property is located.
- flatNumber: The flat number of the property.
- availabilityStatus: The availability status (e.g., "Ready to Move").
- availableFrom: The date when the property is available from.
- ageOfProperty: The age of the property.
- description: A description of the property.
- location: The address details of the property.
-
images (optional): Array of images to upload for the property.
- imageId (optional): The ID of the image to be updated.
- If the
imageIdis provided, the specific image will be updated with the new one. - If no
imageIdis provided, new images will be added.
-
video (optional): The video to upload for the property (optional).
{
"propertyData": {
"location": {
"city": "Mumbai",
"state": "Maharashtra",
"locality": "Andheri",
"subLocality": "Lokhandwala",
"apartment": "ABC Residency",
"houseNumber": "Flat 302"
},
"about": {
"bedrooms": 3,
"bathrooms": 2,
"balconies": 2
},
"propertyArea": {
"carpetArea": 1200,
"builtUpArea": 1400
},
"otherRooms": {
"poojaRoom": true,
"guestRoom": true,
"servantRoom": false,
"studyRoom": true
},
"furnishingDetails": {
"fans": 5,
"lights": 10,
"tv": 2,
"beds": 3,
"ac": 2,
"wardrobes": 3,
"exhaustFans": 2,
"curtains": 6,
"floorLamps": 2,
"diningTable": true,
"sofa": true,
"stove": true,
"kitchenCabinets": true,
"chimney": true,
"coffeeTable": true,
"refrigerator": true,
"microwave": true,
"dishwasher": false,
"waterPurifier": true,
"washingMachine": true
},
"parking": {
"covered": 1,
"open": 1
},
"propertyType": "For Sale",
"category": "Residential",
"furnishingStatus": "Half Furnished",
"totalFloors": 10,
"propertyOnFloor": 3,
"flatNumber": "302",
"availabilityStatus": "Ready to Move",
"availableFrom": "2024-01-01T00:00:00.000Z",
"ageOfProperty": 5,
"description": "Updated property description"
},
"images": [
{
"imageId": "6756b7707d8926a3fc06f3f6"
}
]
}Success Response:
- Status: 200 OK
- Response Body:
{ "message": "Property updated successfully", "property": { "location": { "city": "Mumbai", "state": "Maharashtra", "locality": "Andheri", "subLocality": "Lokhandwala", "apartment": "ABC Residency", "houseNumber": "Flat 302" }, "about": { "bedrooms": 3, "bathrooms": 2, "balconies": 2 }, "propertyArea": { "carpetArea": 1200, "builtUpArea": 1400 }, "otherRooms": { "poojaRoom": true, "guestRoom": true, "servantRoom": false, "studyRoom": true }, "furnishingDetails": { "fans": 5, "lights": 10, "tv": 2, "beds": 3, "ac": 2, "wardrobes": 3, "exhaustFans": 2, "curtains": 6, "floorLamps": 2, "diningTable": true, "sofa": true, "stove": true, "kitchenCabinets": true, "chimney": true, "coffeeTable": true, "refrigerator": true, "microwave": true, "dishwasher": false, "waterPurifier": true, "washingMachine": true }, "parking": { "covered": 1, "open": 1 }, "_id": "675566483c5a4f031885107d", "user": "67555adb6635b9a4fa1b2c7c", "propertyType": "For Sale", "category": "Residential", "furnishingStatus": "Half Furnished", "totalFloors": 10, "propertyOnFloor": 3, "flatNumber": "302", "availabilityStatus": "Ready to Move", "availableFrom": "2024-01-01T00:00:00.000Z", "ageOfProperty": 5, "description": "Updated property description", "images": [ { "name": "updatedHouse.jpg", "url": "https://res.cloudinary.com/dtfhslkcx/image/upload/v1733736305/properties/images/vnnp7r24oyntll4ld9cy.jpg", "_id": "6756b7707d8926a3fc06f3f6" }, { "name": "updatedHouse.jpg", "url": "https://res.cloudinary.com/dtfhslkcx/image/upload/v1733814519/properties/images/sx7jaarn8v3goagadudm.jpg", "_id": "6756b7297d8926a3fc06f3ef" } ], "video": null, "__v": 0 } }
Error Response:
-
Status: 404 Not Found
-
Response Body:
{ "message": "Property not found" } -
Status
: 400 Bad Request
- Response Body:
{ "message": "Property ID is required" }
Route: GET api/properties/alluser-properties
This endpoint fetches the active properties of a user based on their mobile number.
- Method:
GET - Body:
mobile(string, required): The mobile number of the user whose active properties are to be fetched.
-
Status Code:
200 OK- Body:
{ "message": "properties fetched successfully.", "properties": [ /* Array of user active properties */ ] }
- Body:
-
Status Code:
400 Bad Request- Body:
{ "error": "Mobile number is required." }
- Body:
-
Status Code:
404 Not Found- Body:
{ "error": "User not found." }
- Body:
-
Status Code:
500 Internal Server Error-
Body:
{ "error": "An error occurred while fetching properties.", "details": "Error message" }
-
Route: POST api/properties/deleteProperty
This endpoint allows a user to submit feedback and delete a property. The feedback is saved and associated with the user, and the specified property is deleted from the database.
- Method:
POST - Body:
propertyId(string, required): The ID of the property to be deleted.userId(string, required): The ID of the user submitting the feedback.feedback(string, required): The feedback provided by the user.
-
Status Code:
200 OK- Body:
{ "message": "Property deleted successfully. Thank you for your feedback!" }
- Body:
-
Status Code:
400 Bad Request- Body:
{ "error": "Property ID, User ID, Feedback are required." }
- Body:
-
Status Code:
404 Not Found- Body:
{ "error": "Property not found." }
- Body:
-
Status Code:
500 Internal Server Error- Body:
{ "error": "An error occurred while processing the request.", "details": "Error message" }
- Body:
This endpoint retrieves all properties with the status "Active" that are not owned by the requesting user. Properties include detailed information such as reviews and the reviewers' details.
GET /api/properties/availableProperty
Content-Type: application/json
{
"userId": "<user ID>"
}| Field | Type | Required | Description |
|---|---|---|---|
| userId | String | Yes | The unique ID of the user |
{
"message": "Available properties fetched successfully.",
"length": <number of properties>,
"properties": [
{
"_id": "<property ID>",
"name": "<property name>",
"propertyStatus": "Active",
"reviews": [
{
"_id": "<review ID>",
"content": "<review content>",
"user": {
"name": "<user name>",
"email": "<user email>"
}
}
]
//......more details etc.
},
{
//other properties
}
]
}- 400 Bad Request
{
"error": "User ID is required."
}- 404 Not Found
{
"error": "User not found."
}- 500 Internal Server Error
{
"error": "An error occurred while fetching available properties.",
"details": "<error details>"
}- Validation: Ensures the
userIdfield is provided in the request body. - Database Interaction:
- Fetches the user by
userIdand populates the user's properties. - Retrieves properties with
propertyStatus: "Active"that are not owned by the user. - Populates reviews and reviewer details for each property.
- Fetches the user by
- Usage: This endpoint is used to display properties available for interaction or rent by other users.
This endpoint allows a user to post a review for a specific property. The review includes a star rating and text content, which are validated before submission.
POST api/properties/add-review
Content-Type: application/jsonAuthorization: Bearer <token>
{
"propertyId": "<property ID>",
"stars": <number between 1 and 5>,
"text": "<review text>"
}| Field | Type | Required | Description |
|---|---|---|---|
| propertyId | String | Yes | The unique ID of the property |
| stars | Number | Yes | Rating between 1 and 5 |
| text | String | Yes | Review content |
{
"message": "Review posted successfully",
"review": {
"_id": "<review ID>",
"user": "<user ID>",
"property": "<property ID>",
"stars": <number>,
"text": "<review text>"
}
}- 400 Bad Request
{
"error": "Missing required fields: propertyId, stars, or text"
}- 400 Bad Request
{
"error": "Stars rating must be between 1 and 5"
}- 404 Not Found
{
"error": "Property not found"
}- 500 Internal Server Error
{
"error": "Internal server error",
"details": "<error details>"
}- Validation:
- Ensures
propertyId,stars, andtextare provided. - Validates that
starsis a number between 1 and 5.
- Ensures
- Database Interaction:
- Checks if the property exists by
propertyId. - Creates a new review and associates it with the specified property.
- Checks if the property exists by
- Usage: This endpoint is used for adding user feedback about properties.
This endpoint allows a user to edit an existing review. The user can update the star rating and text content of their review.
PATCH api/properties/edit-review/:reviewId
Content-Type: application/jsonAuthorization: Bearer <token>
| Parameter | Type | Required | Description |
|---|---|---|---|
| reviewId | String | Yes | The unique ID of the review |
{
"stars": <number between 1 and 5>,
"text": "<updated review text>"
}| Field | Type | Required | Description |
|---|---|---|---|
| stars | Number | Yes | Updated rating between 1 and 5 |
| text | String | Yes | Updated review content |
{
"message": "Review updated successfully",
"review": {
"_id": "<review ID>",
"user": "<user ID>",
"property": "<property ID>",
"stars": <number>,
"text": "<updated review text>"
}
}- 400 Bad Request
{
"message": "Rating and comment are required"
}- 403 Forbidden
{
"message": "You can only edit your own reviews"
}- 404 Not Found
{
"message": "Review not found"
}- 500 Internal Server Error
{
"message": "Error updating review",
"error": "<error details>"
}- Validation:
- Ensures
starsandtextare provided in the request body. - Confirms that the review belongs to the authenticated user.
- Ensures
- Database Interaction:
- Updates the star rating and text content of the specified review.
- Usage: This endpoint is used for users to modify their submitted feedback.
Endpoint: DELETE /api/properties/delete-review/:reviewId
Description:
This endpoint allows a user to delete their own review for a property. The user must be authenticated to access this endpoint, and they can only delete reviews they have written.
- Path Parameters:
reviewId(string): The ID of the review to be deleted.
Authorization: Bearer token for the authenticated user.
-
200 OK: Review deleted successfully.
Example:{ "message": "Review deleted successfully" } -
404 Not Found: If the review with the specified
reviewIddoes not exist.
Example:{ "message": "Review not found" } -
403 Forbidden: If the user is not the owner of the review.
Example:{ "message": "You can only delete your own reviews" } -
500 Internal Server Error: If there is an error during the process.
Example:{ "message": "Error deleting review", "error": "Detailed error message" }
- Validate Review: The endpoint retrieves the review using the
reviewIdprovided. If the review is not found, a404 Not Foundresponse is returned. - Ownership Check: The endpoint verifies that the authenticated user owns the review. If not, a
403 Forbiddenresponse is returned. - Delete Review:
- Deletes the review from the
Reviewcollection. - Removes the review reference from the associated
Propertydocument. - Saves the updated
Propertydocument.
- Deletes the review from the
- Success Response: Returns a
200 OKresponse with a success message.
- If any error occurs during the process, a
500 Internal Server Errorresponse is sent, along with the error details.
- Ensure that the user authentication middleware is correctly implemented to provide
req.user.userId. - The
reviewIdmust be a valid MongoDB ObjectId. Invalid IDs should be handled gracefully to avoid runtime errors.
Endpoint: GET /api/properties/nearby-properties
Description:
This endpoint allows users to find properties within a specified distance from a given geographical point (latitude and longitude). The response includes nearby properties and their associated reviews.
- Query Parameters:
latitude(number) [Required]: The latitude of the reference point.longitude(number) [Required]: The longitude of the reference point.maxDistance(number) [Required]: The maximum distance in kilometers to search for nearby properties.
URL:
GET /api/properties/nearby-properties?latitude=28.7041&longitude=77.1025&maxDistance=5Request Headers:
{
"Authorization": "Bearer <your_token>"
}-
200 OK: A list of nearby properties is returned.
Example:{ "nearbyProperties": [ { "_id": "63d9f05d3e4567890abc1234", "name": "Sample Property", "location": { "type": "Point", "coordinates": [77.1234, 28.5678] }, "reviews": [ { "_id": "63d9f06f4e567890bca34567", "comment": "Great property!", "rating": 5 } ] } //some more informations ] } -
400 Bad Request: If
latitude,longitude, ormaxDistanceis missing.
Example:{ "message": "Latitude, longitude, and maxDistance are required" } -
404 Not Found: If no properties are found within the specified range.
Example:{ "message": "No nearby properties found" } -
500 Internal Server Error: If there is an error during the process.
Example:{ "message": "Server error, please try again later", "error": "Detailed error message" }
- Validate Inputs: Ensures that
latitude,longitude, andmaxDistanceare provided in the query parameters. If not, a400 Bad Requestresponse is returned. - Convert Distance: Converts
maxDistancefrom kilometers to meters (maxDistance * 1000). - Query Database:
- Uses MongoDB's geospatial
$nearSphereoperator to find properties near the specified coordinates within the maximum distance. - Populates the
reviewsfield for each property.
- Uses MongoDB's geospatial
- Handle Results:
- If properties are found, returns them in a
200 OKresponse. - If no properties are found, returns a
404 Not Foundresponse.
- If properties are found, returns them in a
- Error Handling: Logs the error and returns a
500 Internal Server Errorresponse with error details.
- The
locationfield in thePropertyschema must use MongoDB's 2dsphere index for geospatial queries. - Ensure proper validation and sanitization of query parameters to prevent injection attacks.
- The
maxDistanceparameter should be validated for a reasonable range (e.g., 1–100 kilometers).
This endpoint retrieves a list of properties belonging to a specific category, excluding properties owned by the authenticated user.
| Parameter | Type | Required | Description |
|---|---|---|---|
category |
String | Yes | The category of the properties to retrieve. |
| Header | Type | Required | Description |
|---|---|---|---|
Authorization |
String | Yes | Bearer token for authentication. |
Returns an array of properties for the specified category.
Example Response:
{
"properties": [
{
"_id": "63e6c19ab0413a21a8b3c123",
"name": "Property A",
"category": "Residential",
"price": 5000,
"location": "Delhi",
"user": "63e6c198b0413a21a8b3c122"
//other...
},
{
"_id": "63e6c1a0b0413a21a8b3c124",
"name": "Property B",
"category": "Residential",
"price": 7000,
"location": "Mumbai",
"user": "63e6c199b0413a21a8b3c123"
//other...
}
]
}Returned if the category parameter is missing.
Example Response:
{
"message": "Category is required"
}Returned if no properties are found for the specified category.
Example Response:
{
"message": "No properties found for category: Residential"
}Returned if there is an issue with the server while processing the request.
Example Response:
{
"message": "Server error, please try again later",
"error": "Database connection failed"
}- Validates if
categoryis provided in the query. - Catches errors during database queries and returns a generic server error response with the error message.
This endpoint retrieves a list of notifications for a specific user, sorted in descending order by date.
| Parameter | Type | Required | Description |
|---|---|---|---|
userId |
String | Yes | The ID of the user to fetch notifications for. |
Returns an array of notifications for the specified user.
Example Response:
[
{
"_id": "63e6c19ab0413a21a8b3c125",
"userId": "63e6c198b0413a21a8b3c123",
"message": "Your property has been approved.",
"date": "2024-12-31T10:15:30.000Z",
"read": false
},
{
"_id": "63e6c1a0b0413a21a8b3c126",
"userId": "63e6c198b0413a21a8b3c123",
"message": "A new property matches your preferences.",
"date": "2024-12-30T08:10:15.000Z",
"read": true
}
]Returned if no notifications are found for the specified user.
Example Response:
{
"message": "No notifications found for this user."
}Returned if there is an issue with the server while processing the request.
Example Response:
{
"message": "Error fetching notifications",
"error": "Database query failed"
}- Checks if notifications exist for the specified
userId. If none are found, a 404 response is returned. - Catches errors during database operations and returns a generic server error response with the error message.
- Notifications are sorted by the
datefield in descending order ({ date: -1 }), ensuring the most recent notifications appear first.
- URL:
api/highlights/get-highlights - Method: GET
- Headers:
Authorization: Bearer<access-token>(required)
{
"message": "Available properties fetched successfully for the reel.",
"properties": [
{
"propertyId": "63a8b3f43a123456789abcde",
"video": "https://example.com/videos/property1.mp4",
"user": {
"name": "John Doe",
"mobile": "1234567890"
},
"reviews": [
{
"user": {
"name": "Jane Smith",
"mobile": "0987654321"
},
"stars": 4,
"text": "Great property!"
}
]
}
]
}{
"error": "User ID is required."
}{
"error": "User not found."
}{
"message": "No available properties found.",
"properties": []
}{
"error": "An error occurred while fetching available properties for the reel.",
"details": "Error message details"
}- URL:
/api/wishlist/add-wishlist - Method: POST
- Headers:
Content-Type: application/json
- Body (JSON):
{ "userId": "string", "propertyIds": ["string", "string"] }
{
"message": "Wishlist created successfully",
"wishlist": {
"_id": "63a8b3f43a123456789abcde",
"user": "63a8b3f43a123456789abcd1",
"properties": ["63a8b3f43a123456789abcd2", "63a8b3f43a123456789abcd3"],
"__v": 0
}
}{
"error": "Invalid request data"
}{
"error": "User not found"
}{
"error": "Some properties not found"
}{
"error": "Internal server error"
}- URL:
/get-wishlist/:userId - Method: GET
- Headers:
Content-Type: application/json
- Path Parameters:
userId(string): The ID of the user whose wishlists are to be retrieved.
{
"message": "Wishlists retrieved successfully",
"wishlists": [
{
"_id": "63a8b3f43a123456789abcde",
"user": "63a8b3f43a123456789abcd1",
"properties": [
{
"_id": "63a8b3f43a123456789abcd2",
"reviews": [
{
"_id": "63a8b3f43a123456789abcd3",
"user": {
"name": "John Doe",
"email": "john.doe@example.com"
},
"stars": 4,
"text": "Great property!"
}
]
}
]
}
]
}{
"error": "User ID is required"
}{
"error": "User not found"
}{
"error": "No wishlists found for this user"
}{
"error": "Internal server error"
}- URL:
api/admin/filter-properties - Method: GET
- Headers:
Authorization: Bearer<access-token>(required, must belong to an admin user)Content-Type: application/json
- Query Parameters:
propertyType(string): The type of property to filter (e.g., residential, commercial).category(string): The category of the property (e.g., apartment, villa).
[
{
"_id": "63a8b3f43a123456789abcde",
"propertyType": "residential",
"category": "apartment",
"user": {
"name": "John Doe",
"email": "john.doe@example.com",
"role": "user",
"whatsappMobile": "9876543210"
}
//other details
}
]{
"message": "Please provide all required fields: propertyType, category, and role."
}{
"message": "You are not an admin"
}{
"message": "No properties found matching the criteria."
}{
"message": "Server error",
"error": "Error message details"
}- URL:
/api/admin/get-users - Method: GET
- Headers:
Authorization: Bearer<access-token>(required, must belong to an admin user)Content-Type: application/json
[
{
"_id": "63a8b3f43a123456789abcde",
"name": "John Doe",
"mobile": "9876543210",
"city": "New York",
"email": "john.doe@example.com",
"role": "user",
"whatsappMobile": "9876543210",
"feedbacksGiven": [
{
"_id": "63a8b3f43a123456789abcd1",
"feedbackText": "Great platform!"
}
],
"reviews": [
{
"_id": "63a8b3f43a123456789abcd2",
"stars": 5,
"text": "Excellent service!"
}
]
//other details
}
]{
"message": "You are not an admin"
}{
"message": "No users found."
}{
"message": "Server error while fetching users.",
"error": "Error message details"
}- URL:
api/admin/post-notifications - Method: POST
- Headers:
Authorization: Bearer<access-token>(required, must belong to an admin user)Content-Type: application/json
- Body (JSON):
{ "userId": "string", "heading": "string", "text": "string" }
{
"message": "Notification sent successfully"
}{
"message": "userId, heading, and text are required"
}{
"message": "You are not an admin"
}{
"message": "User not found"
}{
"message": "Error sending notification",
"error": "Error message details"
}