Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GetPasswordRequest ¶
GetPasswordRequest is request body for getting a password. Either ID or UserID is required.
type GetUserRequest ¶
GetUserRequest is request body for getting a user. Either ID or Email is required.
type Gum ¶
type Gum struct {
User UserRepository // User repository
Password PasswordRepository // Password repository
}
Gum is the main struct that implements the Gum interface
type NewPassword ¶
type NewPassword struct {
UserID string `json:"userId"` // ID of the user (required)
Password string `json:"password"` // plain text password (required)
}
NewPassword is request body for creating a new password.
type NewUser ¶
type NewUser struct {
Email string `json:"email"` // Email address of the user (required)
Password string `json:"password"` // Password of the user (required)
FirstName string `json:"first_name"` // First name of the user (optional)
LastName string `json:"last_name"` // Last name of the user (optional)
}
NewUser is request body for creating a new user.
type PasswordRepository ¶
type PasswordRepository interface {
Create(req *NewPassword) (*models.Password, error)
Get(req *GetPasswordRequest) (*models.Password, error)
}
PasswordRepository represents a repository for managing passwords.
type PasswordService ¶
type PasswordService struct {
// contains filtered or unexported fields
}
func (*PasswordService) Create ¶
func (s *PasswordService) Create(req *NewPassword) (*models.Password, error)
Create implements PasswordRepository.Create method using bcrypt to hash the password.
func (*PasswordService) Get ¶
func (s *PasswordService) Get(req *GetPasswordRequest) (*models.Password, error)
Get implements PasswordRepository.Get method by getting the password from the database for the given user ID or password ID.
type User ¶
type User struct {
ID string `json:"id"`
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
Email string `json:"email"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
}
User represents a single user in the system.
type UserRepository ¶
type UserRepository interface {
Create(req *NewUser) (*User, error)
Update(req *User) error
Get(req *GetUserRequest) (*User, error)
}
UserRepository represents a repository for managing users.
type UserService ¶
type UserService struct {
Password PasswordRepository
}
UserService implements UserRepository interface.
func (*UserService) Create ¶
func (s *UserService) Create(req *NewUser) (*User, error)
Create creates a new user.
func (*UserService) Get ¶
func (s *UserService) Get(req *GetUserRequest) (*User, error)
func (*UserService) Update ¶
func (s *UserService) Update(req *User) error
Update updates an existing user.