Skip to content

Instantly share code, notes, and snippets.

@vanstee
Last active May 1, 2017 08:27
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vanstee/6224487 to your computer and use it in GitHub Desktop.
Save vanstee/6224487 to your computer and use it in GitHub Desktop.

Recurrences and Conflicts

To support recurrences and easily resolve conflicting events, we need to support storing multiple events at the same time in the same room. The first event scheduled will be booked as normal. However each subsequent event overlapping that first event will be flagged as conflicting. This will give the user a chance to see the context of their conflicting event and resolve it directly from the normal event view without having to worry about losing their work at any point in the process.

API Changes

POST /events/:event_id/bookings

This route will no longer fail if the booking you are creating overlaps with another already scheduled. The booking will be serialized with a conflict attribute that is computed when the request is made, showing which events are confirmed and which are in conflict.

POST /bookings/search

Bookings will be returned with conflict attributes for you to display.

GET /conflicting_bookings/:booking_id

Use this route to retrieve a list of bookings that are scheduled at the same time in the same room. Each booking will be shown just as they are in the POST /bookings/search route, including the conflict attribute.

POST /bookings/:booking_id/reschedule

When changing the start, end, or room-id of a booking, the conflict attribute may change allowing a now previously scheduled event to take the old spot as the new valid booking.

References

Notes on Recurrences

Notes on Conflict Resolution

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