Interface UserRepository

All Known Implementing Classes:
UserRepositoryImpl

public interface UserRepository
Repository interface for managing User entities. Defines methods for CRUD operations and querying users.
  • Method Details

    • findAll

      Page<User> findAll(int pageNumber, int pageSize)
      Retrieves a paginated list of users.
      Parameters:
      pageNumber - the page number (starting from 0)
      pageSize - the number of the users per page
      Returns:
      a Page containing the requested users
    • findById

      Optional<User> findById(Long id)
      Retrieves an user by its unique identifier.
      Parameters:
      id - the unique identifier of the user
      Returns:
      an Optional containing the user if found, otherwise empty
    • findByEmail

      Optional<User> findByEmail(String email)
      Retrieves a user by its email.
      Parameters:
      email - the email of the user
      Returns:
      an Optional containing the user if found, otherwise empty
    • findByVerificationToken

      Optional<User> findByVerificationToken(String token)
      Retrieves a user by its verification token.
      Parameters:
      token - the verification token of the user
      Returns:
      an Optional containing the user if found, otherwise empty
    • existsByEmail

      boolean existsByEmail(User user)
      Checks whether a user with the same email already exists.
      Parameters:
      user - the user to check
      Returns:
      true if a user with the same email exists, otherwise false
    • existsByPhone

      boolean existsByPhone(User user)
      Checks whether a user with the same phone already exists.
      Parameters:
      user - the user to check
      Returns:
      true if a user with the same phone exists, otherwise false
    • save

      User save(User user)
      Saves a new user or updates an existing one.
      Parameters:
      user - the user to save
      Returns:
      the saved User entity
    • update

      void update(User user)
      Updates an existing user.
      Parameters:
      user - the user entity with updated information
    • delete

      void delete(Long id)
      Deletes an user by its unique identifier.
      Parameters:
      id - the unique identifier of the subject to delete.