I have read the documentation on recurring events on SFCalendar, and I understand that the recurring frequency is a string attribute on 1 given appointment/event. e.g. if 1 appointment recurs 30 next days, it is represented on a data level as 1 appointment with the recurrence being an attribute describing 30 days.
Now, we are working on an application, that creates an availability appointment (i.e. "available times") over a given timeframe for users. What we would like to know, is in Firebase, NOT the calendar, how may we query whether or not this user has a given date x, as available (i.e, query firebase, without downloading all appointments, to find out if date x, is available, taken or not?).
I hope my question is clear. Look forward to your response.
Based on the shared details, we have checked your requirement. In the Firestore database, the appointment recurrence rule is added in the format of a string. The recurrences of the appointment did not store in the fire store database which means the parent appointment details alone can get in the database. You can write the query to get the appointment from the Firestore database. Here we have loaded the appointment to the calendar based on the end-time comparison (IsLessThan). Refer to the below code snippets,
Future<void> getDataFromFireStore() async
var snapShotsValue = await databaseReference
.where('EndTime', isLessThan: Timestamp.fromDate(DateTime(2022, 11, 17, 12, 0, 0)))
List<Meeting> list = snapShotsValue.docs
.map((e) => Meeting(
events = MeetingDataSource(list);
Find the database structure in the Firestore database.
We have prepared a simple sample for the same, please find the attached sample.
If I understand your example correctly, here you are querying the parent appointment, not a recurring instance. e.g. Your appointment is on Nov 17 2022, and your query is against the parent. However that same parent has a recurrence of everyday for the next 15 days (i.e. Nov 17 '22- Dec 2 '22). My question is, how can I query if there is an appointment ON Nov 21 2022. For which there is no "parent" appointment on that given day?
# Regarding how I can query if there is an appointment ON Nov 21 2022
As we mentioned in the previous update, we have added the recurrence appointment on November 17, 2022. This appointment will recur for the next 15 days. In the Firestore database, the parent appointment alone is stored, and the recurrences of the next 15 days will not be stored. In the parent appointment, the recurrence rule is added in string format. So, you cannot able to write a query to get the appointment details on the recurring date (November 21, 2022). For your reference, we have handled the query on the parent appointment in that sample.