Hello there!
We want to develop a smart contract to eliminate the need for a centralized solution like Booking or Airbnb. We are quite confused about choosing the proper data structure for that purpose.
Here are some bullet points we've made so far:
- One may book a hotel only for the future dates
- Check-out date shall be greater than check-in date
- One may book a hotel from the 16th to the 31st of July, e.g., and if now is the 10th of July, then we should allow to book a hotel for dates before the 16th but after the 10th - the main problem lies here.
The first idea is to use mapping (bookingId => Booking) and store the nextBookingId in the Booking structure, which will link to the next chronological booking. In addition, store some mostRecentBookingBeforeToday and update it dynamically when the booking is created...
What do you think?