Class UserRepositoryImpl
java.lang.Object
org.example.crmedu.infrastructure.repository.user.UserRepositoryImpl
- All Implemented Interfaces:
UserRepository
Implementation of the
UserRepository
interface using JPA. Provides methods for managing User
entities in the database.-
Constructor Summary
Constructors -
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.
-
Constructor Details
-
UserRepositoryImpl
public UserRepositoryImpl()
-
-
Method Details
-
findAll
Description copied from interface:UserRepository
Retrieves a paginated list of users.- Specified by:
findAll
in interfaceUserRepository
- Parameters:
pageNumber
- the page number (starting from 0)pageSize
- the number of the users per page- Returns:
- a
Page
containing the requested users
-
findById
Description copied from interface:UserRepository
Retrieves an user by its unique identifier.- Specified by:
findById
in interfaceUserRepository
- Parameters:
id
- the unique identifier of the user- Returns:
- an
Optional
containing the user if found, otherwise empty
-
findByEmail
Description copied from interface:UserRepository
Retrieves a user by its email.- Specified by:
findByEmail
in interfaceUserRepository
- Parameters:
email
- the email of the user- Returns:
- an
Optional
containing the user if found, otherwise empty
-
findByVerificationToken
Description copied from interface:UserRepository
Retrieves a user by its verification token.- Specified by:
findByVerificationToken
in interfaceUserRepository
- Parameters:
token
- the verification token of the user- Returns:
- an
Optional
containing the user if found, otherwise empty
-
existsByEmail
Description copied from interface:UserRepository
Checks whether a user with the same email already exists.- Specified by:
existsByEmail
in interfaceUserRepository
- Parameters:
user
- the user to check- Returns:
true
if a user with the same email exists, otherwisefalse
-
existsByPhone
Description copied from interface:UserRepository
Checks whether a user with the same phone already exists.- Specified by:
existsByPhone
in interfaceUserRepository
- Parameters:
user
- the user to check- Returns:
true
if a user with the same phone exists, otherwisefalse
-
save
Description copied from interface:UserRepository
Saves a new user or updates an existing one.- Specified by:
save
in interfaceUserRepository
- Parameters:
user
- the user to save- Returns:
- the saved
User
entity
-
update
Description copied from interface:UserRepository
Updates an existing user.- Specified by:
update
in interfaceUserRepository
- Parameters:
user
- the user entity with updated information
-
delete
Description copied from interface:UserRepository
Deletes an user by its unique identifier.- Specified by:
delete
in interfaceUserRepository
- Parameters:
id
- the unique identifier of the subject to delete.
-