When a user presses the cross beside an invited user, we should delete the mapping from the user record in the schedules collection, the friend record in the friends collection, and the invite record in the friend-invites collection. Currently, only the schedules collection is updated since the user schedule data is loaded client-side. Updating the other collections requires us to modify other users' records, which is not safe to do so client-side. We need to create and integrate a new Firebase function to update the other collections.
Your Goal
[x] Create a Firebase function that:
deletes any friend-invites record that corresponds to the current user, friend, term, and schedule version.
updates the friend's friends record such that the current user's schedule version is removed from the accessibleSchedules[userId] array for the chosen term
[x] Integrate the Firebase function with the handleDelete method in src/components/InvitationModal
Problem Description
When a user presses the cross beside an invited user, we should delete the mapping from the user record in the
schedules
collection, the friend record in thefriends
collection, and the invite record in thefriend-invites
collection. Currently, only theschedules
collection is updated since the user schedule data is loaded client-side. Updating the other collections requires us to modify other users' records, which is not safe to do so client-side. We need to create and integrate a new Firebase function to update the other collections.Your Goal
friend-invites
record that corresponds to the current user, friend, term, and schedule version.friends
record such that the current user's schedule version is removed from theaccessibleSchedules[userId]
array for the chosen termhandleDelete
method insrc/components/InvitationModal