Data validation before submit

HI, I am building an AirBnb like app and I am facing an issue with booking validation: I want the user to be able to book in a site only if there is still some space left in this site.

My database looks like this:

  • Sites:
    • info about the site, amongst them “capacity”
    • bookings, 1-to-many relationship to a Booking, ie one site can have several bookings
  • Bookings:
    • date from/to
    • site

How can I make sure that for each day of a new booking, the count of booking is lower than the capacity?

Eventually I would also like to be able to count bookings per day to display filling per day.


Hi Clément,

In the sites collection, add a field and name it ‘counter’ (number) and then when you create the site availability record, add a number in the ‘counter’ field and this will act as your limit of bookings.

Then, every time someone books the site, set an action - Update current site > counter -1 , then set the action to only run if current site > counter is greater than 0.

You can then filter a site list to only show sites where the counter = greater than 0.

Hope this helps :slight_smile:

1 Like

My boy came back! :slight_smile:

Thanks for the suggestions. It sounds like it is the same as doing

, isn’t it ?

My concern is about the dates because say an hotel may have 10 rooms, some days there are 5 peoples, some others 9, etc. and when performing a booking I need to make sure that for each selected day, the number won’t be greater than the capacity.

Add an additional filter on that above screenshot
Current Site > Bookings > Count

    Date = blahblah Date
1 Like

Actually I have “Date From” and “Date To”, so I should check for every single date in this interval. I don’t know how to use your solution, the only thing I can think of is

but it is not a proper solution.

Can you put 2 filters. Date is after start date and date is before end date?

I don’t understand how your proposition differ from my second screen shot.

But let us take an example. Site has 2 as capacity, so two simultaneous bookings are possible.
Imagine there is one booking from 1 to 10 and another from 10 to 20 of a given month.
Imagine now that I want to book from 1 to 20. This should be possible because capacity is two. However with these filters I would have both booking in between the requested dates, so a count of 2 == max capacity.


Hey, should I conclude that there is no current solution to my problem with base adalo and that consequently I should upgrade to pro version to base my app on airflow?