Skip to content

Amaresh taking over for Alisha - feat(listing-overview): add listing overview backend implementation#1780

Open
alishawalunj wants to merge 6 commits into
developmentfrom
alisha/feature/listing-overview
Open

Amaresh taking over for Alisha - feat(listing-overview): add listing overview backend implementation#1780
alishawalunj wants to merge 6 commits into
developmentfrom
alisha/feature/listing-overview

Conversation

@alishawalunj

Copy link
Copy Markdown
Contributor

Description

9783D184-632E-4BB4-8784-EDEA76475B28

Related PRS (if any):

This backend PR is not related to any backend PR.

Main Changes

  • Configured schema for the Bookings collection.
  • Implemented controller functionalities:
    • Get Listing Overview
    • Submit Booking
  • Configured routes for both APIs.

How to Test

  1. Checkout this branch.
  2. Run npm install and start the server (e.g., npm run dev).
  3. Test the endpoints in Postman or your API client:

Get Listing Overview

Submit Booking Request

{
  "listingId": "68c5e69e7b6edc12ba7402cc",
  "rentingFrom": "2025-10-28",
  "rentingTill": "2025-10-29"
}
  1. Verify that date validation works:
    • rentingFrom must be before rentingTill.
    • Overlapping bookings should return a conflict error.
    • Successful bookings return a confirmation with the booking ID.

Screenshots or videos of changes:

F059C645-152B-4B7F-B9D0-ECF40028B9A2

61BA12E1-BED1-4B54-B54B-F3A65EE3E402

@alishawalunj alishawalunj added the High Priority - Please Review First This is an important PR we'd like to get merged as soon as possible label Oct 4, 2025

@akshith312 akshith312 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested PR locally.
Checked the endpoints for different properties.
All the end points work as expected.

image Conflict on booking dates: image Successful Booking: image Date Check: image

@one-community one-community changed the title Alisha - feat(listing-overview): add listing overview backend implementation Amaresh taking over for Alisha - feat(listing-overview): add listing overview backend implementation Jun 10, 2026

@DeepighaJ DeepighaJ left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked out to current branch and tested PR locally. The Get Listing overview works as expected. But the Submit book request gives 400 Bad request stating "message": "Missing required fields: listingId, rentingFrom, rentingTill" so couldnt validate the date and conflict error validations.
Image
Image
Image

@amaresh2001

amaresh2001 commented Jun 20, 2026

Copy link
Copy Markdown

@DeepighaJ Use raw format in the Body tab as JSON instead of Text in the dropdown. Could you please re-review when you get a chance? Thank you!

Screenshot 2026-06-19 at 8 57 51 PM

If you use an invalid date range, a message will be returned
Screenshot 2026-06-19 at 9 12 53 PM

@kzou55 kzou55 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ran the current branch locally, and I can verify the following works:

  • Get listing overview
    Image

  • Submit successful booking
    Image

  • Invalid Date Range Error

Image
  • Booking Conflict
Image

Issues:

  • Error message for bad date value for "rentingTill" field is fine
    Image
    However, the return message isn't correct if the "rentingFrom" field is a bad date value

    Image

@amaresh2001

Copy link
Copy Markdown

@kzou55 Fixed the invalid date value issue. Added explicit Number.isNaN() validation for both rentingFrom and rentingTill before any DB operations, so bad date values now return a proper 400 with the
correct field name instead of a 500 Mongoose cast error. Tested locally and confirmed:

  • Bad rentingFrom → 400 "Invalid date value for rentingFrom"
  • Bad rentingTill → 400 "Invalid date value for rentingTill"

Could you please re-review when you get a chance? Thank you!

Screenshot 2026-06-25 at 10 40 50 AM Screenshot 2026-06-25 at 10 41 38 AM

@sonarqubecloud

Copy link
Copy Markdown

@kzou55 kzou55 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Amaresh,

I retested the PR again and I verified that get listing overviews, submitting book request and date validation works.

  • Get Listing Overview

    • Valid IDs
      Image
      Image
      Image
    • Invalid Listing ID:
      Image
  • Submit Booking Request

    • Correct submit booking request
      Image

    • Invalid Listing ID
      Image

    • Booking conflict
      Image

    • Missing Fields
      Image

    • Invalid renting from and renting till dates
      Image
      Image

    • rentingFrom must be before rentingTill
      Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

High Priority - Please Review First This is an important PR we'd like to get merged as soon as possible

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants