Class EventsDB

java.lang.Object
com.example.rocket_launch.EventsDB

public class EventsDB extends Object
class to help with firestore database
  • Constructor Details

    • EventsDB

      public EventsDB()
      constructor
  • Method Details

    • addCreatedEvent

      public void addCreatedEvent(Event event, String androidId, com.google.android.gms.tasks.OnCompleteListener<Void> onCompleteListener)
      add a created event to database Author: Kaiden
      Parameters:
      event - event to add
      androidId - androidId of who wants to add
      onCompleteListener - listener for what to do on completion
    • getEventsRef

      public com.google.firebase.firestore.CollectionReference getEventsRef()
      Get the reference to the events collection.
      Returns:
      CollectionReference to the events collection
    • addUserToWaitingList

      public void addUserToWaitingList(String eventID, String userID)
      Add user to waiting list and check max waiting list size Author: Kaiden
      Parameters:
      eventID - add user to event wit heventID
      userID - user to add to waitlist
    • removeUserFromWaitingList

      public void removeUserFromWaitingList(String eventID, String userID)
      Remove user from waiting list Author: Kaiden
      Parameters:
      eventID - id of event who's waitlist we want to remove from
      userID - id of user to remove from waitlist
    • addUserToRegisteredList

      public void addUserToRegisteredList(String eventID, String userID)
      Remove user from registered list Author: Kaiden
      Parameters:
      eventID - id of event who's registered list we want to remove from
      userID - id of user to remove from registered list
    • removeUserFromRegisteredList

      public void removeUserFromRegisteredList(String eventID, String userID)
      Remove user from registered list Author: Kaiden
      Parameters:
      eventID - id of event who's registered list we want to remove from
      userID - id of user to remove from registered list
    • removeUserFromInvitedList

      public void removeUserFromInvitedList(String eventId, String userId)
      remove a user from an events invited list Author: Kaiden
      Parameters:
      eventId - id of event
      userId - id of user
    • addUserToCancelledList

      public void addUserToCancelledList(String eventId, String userId)
      adds a user to a given event's cancelled list Author: Kaiden
      Parameters:
      eventId - event to add user to
      userId - user to add
    • updateEvent

      public void updateEvent(String eventId, Event event, com.google.android.gms.tasks.OnSuccessListener<Void> onSuccess, com.google.android.gms.tasks.OnFailureListener onFailureListener)
      updates a given event(eventId) with new event data store in event Author: Kaiden
      Parameters:
      eventId - id of event to update
      event - updated data to load
      onSuccess - callback for if firestore succeeds
      onFailureListener - callback for if firestore fails
    • loadEvent

      public void loadEvent(String id, com.google.android.gms.tasks.OnSuccessListener<Event> onSuccess)
      loads a given event with eventID id
      Parameters:
      id - id of event to load
      onSuccess - listener for what to do on successful load
    • getWaitlistedUserIds

      public void getWaitlistedUserIds(String eventId, com.google.android.gms.tasks.OnSuccessListener<List<String>> onSuccess, com.google.android.gms.tasks.OnFailureListener onFailure)
      gets list of user Ids from an event's waitlist
      Parameters:
      eventId - id of event
      onSuccess - what to do on success
      onFailure - what to do on failure
    • getInvitedUserIds

      public void getInvitedUserIds(String eventId, com.google.android.gms.tasks.OnSuccessListener<List<String>> onSuccess, com.google.android.gms.tasks.OnFailureListener onFailure)
      gets list of user Ids from an event's Invited list
      Parameters:
      eventId - id of event
      onSuccess - what to do on success
      onFailure - what to do on failure
    • getCancelledUserIds

      public void getCancelledUserIds(String eventId, com.google.android.gms.tasks.OnSuccessListener<List<String>> onSuccess, com.google.android.gms.tasks.OnFailureListener onFailure)
      gets list of user Ids from an event's cancelled list
      Parameters:
      eventId - id of event
      onSuccess - what to do on success
      onFailure - what to do on failure
    • getRegisteredUserIds

      public void getRegisteredUserIds(String eventId, com.google.android.gms.tasks.OnSuccessListener<List<String>> onSuccess, com.google.android.gms.tasks.OnFailureListener onFailure)
      gets list of user Ids from an event's final list
      Parameters:
      eventId - id of event
      onSuccess - what to do on success
      onFailure - what to do on failure
    • getAllEventsInList

      public void getAllEventsInList(List<String> eventsList, com.google.android.gms.tasks.OnSuccessListener<List<Event>> onSuccess, com.google.android.gms.tasks.OnFailureListener onFailure)
      get all events in a string of eventId's Author: Kaiden
      Parameters:
      eventsList - list of events to get
      onSuccess - what to do on successful load
      onFailure - what to do on failed load
    • addToEntrantLocationDataList

      public void addToEntrantLocationDataList(String eventID, EntrantLocationData entrantLocation)
      adds entrant location to list of location data for the event Author: Rachel
      Parameters:
      eventID - id of event to add
      entrantLocation - location of entrant signing up
    • removeFromEntrantLocationDataList

      public void removeFromEntrantLocationDataList(String eventID, String entrantID)
      Remove location data from the database Author: Rachel
      Parameters:
      eventID - id of event to remove user location form
      entrantID - id of user of which to remove data
    • deleteEvent

      public void deleteEvent(String eventId, com.google.android.gms.tasks.OnSuccessListener<Void> onSuccess, com.google.android.gms.tasks.OnFailureListener onFailure)
      Delete an event from the database. Author: Kaiden
      Parameters:
      eventId - The ID of the event to delete.
      onSuccess - Callback for successful deletion.
      onFailure - Callback for failed deletion.