Skip to content

Check every day of a booking on the server #346

Open

Description

@Mamel0uk

The Firestore rules only check that a booking's first and last days are offered by the listing (#313), because rules can't loop over a range. A modified client can still book [d, d+2] when only d and d+2 are offered.

Idea: a Cloud Function on booking creation that checks every day in the range is in availableDates, and rejects or deletes the booking if not. The app itself only lets you pick offered days, so this only matters against modified clients.

Activity

  1. lucaschristiansson commented on Nov 17, 2026

    @lucaschristiansson
    Contributor

    Update from #360: bookings now store a days list, and the rules check every day with listing.availableDates.hasAll(data.days). So the gap described here (a day in the middle that is not offered) is closed once #360 merges.

    What remains: rules can't loop over the list, so only the first day is checked against today. A modified client could still put a later past day in the list if the listing still offers it. The app sends days earliest first and never offers a past day. A Cloud Function would still be the way to check every day against today.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions