Documentation ¶
Index ¶
- type UserService
- func (s *UserService) CheckLastLogin(userID uuid.UUID) (bool, error)
- func (s *UserService) CreateUser(fullName, email, password string, role modeluser.Role) error
- func (s *UserService) DeleteUser(id uuid.UUID) error
- func (s *UserService) GetAllUsers() ([]modeluser.User, error)
- func (s *UserService) GetUserByEmail(email string) (*modeluser.User, error)
- func (s *UserService) GetUserByUUID(id uuid.UUID) (*modeluser.User, error)
- func (s *UserService) IsEmailExists(email string) bool
- func (s *UserService) IsEmailExistsForOtherUser(email string, excludeUserID uuid.UUID) bool
- func (s *UserService) IsSoftDeleted(userID uuid.UUID) (bool, error)
- func (s *UserService) RestoreUser(id uuid.UUID) error
- func (s *UserService) SoftDeleteUser(id uuid.UUID) error
- func (s *UserService) UpdateLastLogin(userID uuid.UUID, lastLogin *time.Time) error
- func (s *UserService) UpdateUser(userID uuid.UUID, fullName, email string) error
- func (s *UserService) VerifyUserPassword(email, password string) (bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type UserService ¶
type UserService struct {
// contains filtered or unexported fields
}
UserService provides business logic for user operations.
func NewUserService ¶
func NewUserService(userStore storageuser.UserStore) *UserService
NewUserService creates a new instance of UserService.
func (*UserService) CheckLastLogin ¶
func (s *UserService) CheckLastLogin(userID uuid.UUID) (bool, error)
CheckLastLogin checks if the user exists and has an active session.
func (*UserService) CreateUser ¶
func (s *UserService) CreateUser(fullName, email, password string, role modeluser.Role) error
CreateUser handles the creation of a new user, including password hashing.
func (*UserService) DeleteUser ¶
func (s *UserService) DeleteUser(id uuid.UUID) error
DeleteUser deletes a user by UUID.
func (*UserService) GetAllUsers ¶
func (s *UserService) GetAllUsers() ([]modeluser.User, error)
func (*UserService) GetUserByEmail ¶
func (s *UserService) GetUserByEmail(email string) (*modeluser.User, error)
func (*UserService) GetUserByUUID ¶
GetUserByUUID retrieves a user by their UUID.
func (*UserService) IsEmailExists ¶
func (s *UserService) IsEmailExists(email string) bool
IsEmailExists checks if the provided email exists in the system.
func (*UserService) IsEmailExistsForOtherUser ¶
func (s *UserService) IsEmailExistsForOtherUser(email string, excludeUserID uuid.UUID) bool
IsEmailExistsForOtherUser checks if the provided email exists for any user other than the one with the given UUID.
func (*UserService) IsSoftDeleted ¶
func (s *UserService) IsSoftDeleted(userID uuid.UUID) (bool, error)
IsSoftDeleted checks if a user is soft-deleted.
func (*UserService) RestoreUser ¶
func (s *UserService) RestoreUser(id uuid.UUID) error
RestoreUser reactivates a soft-deleted user.
func (*UserService) SoftDeleteUser ¶
func (s *UserService) SoftDeleteUser(id uuid.UUID) error
SoftDeleteUser marks a user as deleted without actually removing them from the database.
func (*UserService) UpdateLastLogin ¶
UpdateLastLogin updates only the last login time of the user
func (*UserService) UpdateUser ¶
func (s *UserService) UpdateUser(userID uuid.UUID, fullName, email string) error
UpdateUser updates an existing user's information.
func (*UserService) VerifyUserPassword ¶
func (s *UserService) VerifyUserPassword(email, password string) (bool, error)
VerifyUserPassword checks if the provided password matches the user's stored password.