Package com.alpaca.service
Interface IUserService
- All Superinterfaces:
IGenericService<User,UUID>
- All Known Implementing Classes:
UserServiceImpl
Service interface for managing
User entities. Extends IGenericService to inherit
common CRUD operations.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionbooleanexistsByEmail(String email) Checks if a user exists by their email address.findByEmail(String email) Finds a user by their email address.Registers a new User entity in the system.Methods inherited from interface com.alpaca.service.IGenericService
deleteById, existsAllByIds, existsById, existsByUniqueProperties, findAll, findAllByIds, findAllByIdsToSet, findAllPage, findById, save, saveAll, updateById
-
Method Details
-
findByEmail
Finds a user by their email address.- Parameters:
email- The email address of the user - must not be null.- Returns:
- The
Userentity if found. - Throws:
BadRequestException- if the email is null.NotFoundException- if the entity is not found.
-
register
Registers a new User entity in the system.This method should be used only after verifying that no existing user has the same email by calling
existsByEmail(String email). If a user with the given email already exists, an exception must be thrown before calling this method.- Parameters:
user- The user entity to register - must not be null.- Returns:
- The registered user entity.
- Throws:
BadRequestException- If the provided user data is null.
-
existsByEmail
Checks if a user exists by their email address.- Parameters:
email- The email address to check - must not be null.- Returns:
trueif a user with the given email exists, otherwisefalse.
-