Package com.example.rocket_launch
Class UsersDB
java.lang.Object
com.example.rocket_launch.UsersDB
databse class for interfacing with database
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCreatedEvent(String androidId, String eventID) add event to user's created eventsvoidaddNotification(String androidID, Notification notification) adds a notification to databasevoidaddRegisteredEvent(String androidId, String eventID) add event to user's registered eventsvoidadd a g iven user to databasevoidaddWaitlistedEvent(String androidId, String eventID) add event to user waitlistvoiddeleteFacility(String androidId, com.google.android.gms.tasks.OnSuccessListener<Void> onSuccessListener) voiddeleteUser(String androidId, com.google.android.gms.tasks.OnSuccessListener<Void> onSuccessListener) voidgetAllUsersInList(List<String> usersList, com.google.android.gms.tasks.OnSuccessListener<List<User>> onSuccess, com.google.android.gms.tasks.OnFailureListener onFailure) get all users in a string if androidId'svoidgetCreatedEventIds(String androidId, com.google.android.gms.tasks.OnSuccessListener<List<String>> onSuccess, com.google.android.gms.tasks.OnFailureListener onFailure) gets list of event titles from user's created events listvoidgetRegisteredEventIds(String androidId, com.google.android.gms.tasks.OnSuccessListener<List<String>> onSuccess, com.google.android.gms.tasks.OnFailureListener onFailure) gets list of event titles from user's created events listvoidgetUser(String androidId, com.google.android.gms.tasks.OnSuccessListener<User> onSuccess, com.google.android.gms.tasks.OnFailureListener onFailure) gets user from databasecom.google.firebase.firestore.CollectionReferencegets user collection referencevoidgetWaitlistedEventIds(String androidId, com.google.android.gms.tasks.OnSuccessListener<List<String>> onSuccess, com.google.android.gms.tasks.OnFailureListener onFailure) gets list of event titles from user's created events listvoidremoveCreatedEvent(String androidId, String eventID) remove event from user's created evetnsvoidremoveNotification(String androidID, Notification notification) removes notification from databasevoidremoveRegisteredEvent(String androidId, String eventID) remove event from user registered event listvoidremoveWaitlistedEvent(String androidId, String eventID) remove event from user waitlistvoidused for updating a user androidId with new contents contained in uservoidupdateUser(String androidId, User user, com.google.android.gms.tasks.OnSuccessListener<Void> onSuccess, com.google.android.gms.tasks.OnFailureListener onFailureListener)
-
Constructor Details
-
UsersDB
public UsersDB()constructor
-
-
Method Details
-
addUser
add a g iven user to database- Parameters:
androidId- unique id of useruser- user information to add
-
getUser
public void getUser(String androidId, com.google.android.gms.tasks.OnSuccessListener<User> onSuccess, com.google.android.gms.tasks.OnFailureListener onFailure) gets user from database- Parameters:
androidId- id of useronSuccess- listener for onSuccess, will pass a User user where if a user is in the db user != nullonFailure- listener for onFailure
-
updateUser
-
setRoles
used for updating a user androidId with new contents contained in user- Parameters:
androidId- id of user info to updateroles- roles to update to user info
-
addNotification
adds a notification to database- Parameters:
androidID- id of user to add tonotification- notification data to add
-
removeNotification
removes notification from database- Parameters:
androidID- id of user to remove fromnotification- notification to remove
-
addWaitlistedEvent
add event to user waitlist- Parameters:
androidId- id of usereventID- id of event
-
removeWaitlistedEvent
remove event from user waitlist- Parameters:
androidId- id of usereventID- id of event
-
addRegisteredEvent
add event to user's registered events- Parameters:
androidId- id of usereventID- id of event
-
removeRegisteredEvent
remove event from user registered event list- Parameters:
androidId- id of usereventID- id of event
-
addCreatedEvent
add event to user's created events- Parameters:
androidId- id of usereventID- id of event
-
removeCreatedEvent
remove event from user's created evetns- Parameters:
androidId- id of usereventID- id of event
-
getUsersRef
public com.google.firebase.firestore.CollectionReference getUsersRef()gets user collection reference- Returns:
- returns user collection reference
-
getCreatedEventIds
public void getCreatedEventIds(String androidId, com.google.android.gms.tasks.OnSuccessListener<List<String>> onSuccess, com.google.android.gms.tasks.OnFailureListener onFailure) gets list of event titles from user's created events list- Parameters:
androidId- id of user to get events from
-
getRegisteredEventIds
public void getRegisteredEventIds(String androidId, com.google.android.gms.tasks.OnSuccessListener<List<String>> onSuccess, com.google.android.gms.tasks.OnFailureListener onFailure) gets list of event titles from user's created events list- Parameters:
androidId- id of user to get events from
-
getWaitlistedEventIds
public void getWaitlistedEventIds(String androidId, com.google.android.gms.tasks.OnSuccessListener<List<String>> onSuccess, com.google.android.gms.tasks.OnFailureListener onFailure) gets list of event titles from user's created events list- Parameters:
androidId- id of user to get events from
-
getAllUsersInList
public void getAllUsersInList(List<String> usersList, com.google.android.gms.tasks.OnSuccessListener<List<User>> onSuccess, com.google.android.gms.tasks.OnFailureListener onFailure) get all users in a string if androidId's- Parameters:
usersList- list of user to getonSuccess- what to do on successful loadonFailure- what to do on failed load
-
deleteFacility
-
deleteUser
-