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 Summary
Modifier and TypeMethodDescriptionvoid
Deletes an user by its unique identifier.boolean
existsByEmail
(User user) Checks whether a user with the same email already exists.boolean
existsByPhone
(User user) Checks whether a user with the same phone already exists.findAll
(int pageNumber, int pageSize) Retrieves a paginated list of users.findByEmail
(String email) Retrieves a user by its email.Retrieves an user by its unique identifier.findByVerificationToken
(String token) Retrieves a user by its verification token.Saves a new user or updates an existing one.void
Updates an existing user.
-
Method Details
-
findAll
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
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
Retrieves a user by its email.- Parameters:
email
- the email of the user- Returns:
- an
Optional
containing the user if found, otherwise empty
-
findByVerificationToken
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
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, otherwisefalse
-
existsByPhone
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, otherwisefalse
-
save
Saves a new user or updates an existing one.- Parameters:
user
- the user to save- Returns:
- the saved
User
entity
-
update
Updates an existing user.- Parameters:
user
- the user entity with updated information
-
delete
Deletes an user by its unique identifier.- Parameters:
id
- the unique identifier of the subject to delete.
-