Skip to main content

Black Friday 2025! Only until December 1st: coupon FRIDAY25 for 40% off Yearly/Lifetime membership!

Read more here

Apartment Prices per Calendar Days

Premium
12 min read

Time to actually start booking properties. But first, how much would they cost? Let's introduce the pricing structure.

To be honest, if we try to implement all possible pricing features from Booking.com, that alone would take weeks to write/read: various "genius levels" for discounts, different prices per guest, etc.

So let's focus on the core functionality: pricing per calendar days. Typically, some resorts would cost more in July than in January, so let's work on modeling exactly that.


Goals of This Lesson

  • Prices DB structure
  • Showing prices in search results
  • Filter by price range
  • Automated test for pricing

By the end of this lesson, we will have this price calculated and shown in Postman:


Prices DB Structure

We will attach the price not to the property but to the Apartment level. The apartment may have many prices, depending on dates, so here's our DB structure for it:...

The Full Lesson is Only for Premium Members

Want to access all of our courses? (29 h 14 min)

You also get:

54 courses
Premium tutorials
Access to repositories
Private Discord
Get Premium for $129/year or $29/month

Already a member? Login here

Comments & Discussion

NM
Njuguna Mwangi ✓ Link copied!

Here's something I dont get, the tests run smoothly but price result in postman is 0

PR
Patryk Rogala ✓ Link copied!

Hi, this scope is not working properly. Look at this example:

Guests are leaving the apartment on 2025-02-20, and new guests want to book it from the same date. This should be possible, but it's not. The first guests leave the apartment, for example, at 10 AM, and the new guests should be able to book it from 2 PM.

For calculate price this scope is okay, but not for bookings.