Class NotificationRepository

java.lang.Object
com.example.skeddly.business.database.repository.GenericRepository<Notification>
com.example.skeddly.business.database.repository.NotificationRepository

public class NotificationRepository extends GenericRepository<Notification>
A class to handle retrieving notifications from Firestore. This class is (typically) associated with a particular user, which is relevant when performing aggregate retrievals.
  • Field Details

  • Constructor Details

    • NotificationRepository

      public NotificationRepository(com.google.firebase.firestore.FirebaseFirestore firestore, @Nullable String userId, @Nullable NotificationType notificationType)
      Create a new NotificationRepository. The repository is associated with a particular user, and type of notification unless the userId or type is null. If the userId is null, the repository shall retrieve notifications for all users. If the type is null, the repository shall retrieve notifications of any type.
      Parameters:
      firestore - The FirebaseFirestore instance to use.
      userId - The user id that this repository is associated with.
      notificationType - The notification type that this repository is associated with.
    • NotificationRepository

      public NotificationRepository(com.google.firebase.firestore.FirebaseFirestore firestore, @Nullable String userId)
      Create a new NotificationRepository. The repository is associated with a particular user, and type of notification unless the userId is null. If it is, the repository shall retrieve notifications for all users.
      Parameters:
      firestore - The FirebaseFirestore instance to use.
      userId - The user id that this repository is associated with.
    • NotificationRepository

      public NotificationRepository(com.google.firebase.firestore.FirebaseFirestore firestore)
      Create a new NotificationRepository that is not tied to a specific user.
      Parameters:
      firestore - The FirebaseFirestore instance to use.
  • Method Details

    • getCollectionPath

      protected com.google.firebase.firestore.CollectionReference getCollectionPath()
      Description copied from class: GenericRepository
      This method retrieves the reference to the collection of documents it handles
      Specified by:
      getCollectionPath in class GenericRepository<Notification>
      Returns:
      A CollectionReference to the collection of documents it handles.
    • getQuery

      protected com.google.firebase.firestore.Query getQuery()
      Description copied from class: GenericRepository
      This method retrieves a query for getting all the documents handled by this repository. This is commonly overridden in repositories that filter out documents by fields.
      Overrides:
      getQuery in class GenericRepository<Notification>
      Returns:
      A query that can retrieve multiple documents.