Class SessionRepository

java.lang.Object
com.coachconnect.repository.SessionRepository

public class SessionRepository extends Object
Repository for accessing session data from the database.
  • Constructor Details

    • SessionRepository

      public SessionRepository(DatabaseManager dbManager)
    • SessionRepository

      public SessionRepository()
  • Method Details

    • findByUserId

      public Result<List<Session>,String> findByUserId(String userId)
      Finds all sessions.
      Returns:
      A Result containing the list of sessions or an error message
    • findAll

      public Result<List<Session>,String> findAll()
    • findById

      public Result<Session,String> findById(String id)
      Finds a session by its ID.
      Parameters:
      id - The session ID
      Returns:
      A Result containing the session or an error message
    • save

      public Result<Session,String> save(Session session)
      Saves a new session.
      Parameters:
      session - The session to save
      Returns:
      A Result containing the saved session or an error message
    • update

      public Result<Session,String> update(Session session)
      Updates an existing session.
      Parameters:
      session - The session to update
      Returns:
      A Result containing the updated session or an error message
    • deleteById

      public Result<String,String> deleteById(String id)
      Deletes a session by its ID.
      Parameters:
      id - The session ID
      Returns:
      A Result containing a success message or an error message
    • existsById

      public boolean existsById(String id)
      Checks if a session exists by its ID.
      Parameters:
      id - The session ID
      Returns:
      true if the session exists, false otherwise