I am new to firebase, and am building an android app to practice. My app is very straightforward. There are Users, who can create an Event. Other users can either accept or reject an invitation to an Event. To keep things simple, whenever an Event is created, all Users in the database get invited to that Event.
My database is currently structured like this:
What I want to do now is for each Event, I want to know which Users have accepted, declined, or are yet to respond to the invitation.
I am unsure the best way to approach this. These are some ideas I have had:
For an Event, create 3 children which will store all the User information for each response option. (accepted, rejected, pending).
For an Event, create a child 'responses' which will have each Users uid as a key, and the value could be either "accepted", "rejected", or "pending".
Something else completely.
Option 1 seems like it can work, however it means that a User data is going to be copied all over the database. If a User is invited to 1000 events, there will be a copy of that User literally 1000 times, once within every Event.
Option 2 seems logical to me, however I have tried implementing it and am having difficulties building a firebase Query. If I want all the accepted users, I need to get all the uids of the 'acceptedUsers' child, and then pull out of the 'users' node all the children that match these uids. This doesn't seem to be possible...?
Any help or guidance would be greatly appreciated!!