userbusiness

package
v0.0.0-...-435fad9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 10, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

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

func (s *UserService) GetUserByUUID(id uuid.UUID) (*modeluser.User, error)

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

func (s *UserService) UpdateLastLogin(userID uuid.UUID, lastLogin *time.Time) error

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL