Interface UserService
- All Known Implementing Classes:
UserServiceImpl
public interface UserService
Service interface for managing
User
entities. Define methods for CRUD operations and querying users.-
Method Summary
Modifier and TypeMethodDescriptionCreates a new user.void
Deletes a user by its unique identifier.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 token.void
Updates an existing user.void
Verifies user in system by his verification token.
-
Method Details
-
create
Creates a new user. If user has role 'tutor', a tutor corresponding to that user is also created.- Parameters:
user
- the user to create- Returns:
- the created
User
- Throws:
EntityExistsException
- if a user with the same email or phone already exists
-
findById
Retrieves an user by its unique identifier.- Parameters:
id
- the unique identifier of the user- Returns:
- the found
User
- Throws:
EntityNotFoundException
- if no user with the given ID is found
-
findByEmail
Retrieves a user by its email.- Parameters:
email
- the email of the user- Returns:
- the found
User
- Throws:
EntityNotFoundException
- if no user with the given email is found
-
findByVerificationToken
Retrieves a user by its token.- Parameters:
token
- the verification token of the user- Returns:
- the found
User
- Throws:
EntityNotFoundException
- if no user with the given token is found
-
findAll
Retrieves a paginated list of users.- Parameters:
pageNumber
- the page number (starting from 0)pageSize
- the number of users per page- Returns:
- a
Page
containing the requested users
-
update
Updates an existing user.- Parameters:
user
- the updated user dataid
- the unique identifier of the user to update- Throws:
EntityNotFoundException
- if no user with the given ID is foundEntityExistsException
- if a user with the same email or phone already exists
-
delete
Deletes a user by its unique identifier.- Parameters:
id
- the unique identifier of the user to delete
-
verifyUserByVerificationToken
Verifies user in system by his verification token.- Parameters:
token
- verification token of the user
-