Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ResetPasswordRequest ¶
type ResetPasswordRequest struct {
Email string `json:"email"`
Password string `json:"password"`
NewPassword string `json:"new_password"`
}
func (*ResetPasswordRequest) Validate ¶
func (r *ResetPasswordRequest) Validate() error
type User ¶
type User struct {
ID int64 `db:"id"`
Name string `db:"name"`
Email string `db:"email"`
Password string `db:"password"`
Status bool `db:"status"`
CreatedAt time.Time `db:"created_at"`
CreatedBy int64 `db:"created_by"`
}
func (*User) ToUserResponse ¶
func (u *User) ToUserResponse(token, refreshToken string) UserResponse
type UserFromRequest ¶
type UserFromRequest struct {
Name string `json:"name"`
Email string `json:"email"`
Password string `json:"password"`
}
func (*UserFromRequest) Validate ¶
func (u *UserFromRequest) Validate(checkType string) error
type UserHandler ¶
type UserHandler struct {
// contains filtered or unexported fields
}
func NewUserHandler ¶
func NewUserHandler(service UserService, jwt *middleware.JWTService) *UserHandler
func (*UserHandler) CreateUser ¶
func (uh *UserHandler) CreateUser(ctx *gin.Context)
func (*UserHandler) Login ¶
func (uh *UserHandler) Login(ctx *gin.Context)
func (*UserHandler) ResetPassword ¶
func (uh *UserHandler) ResetPassword(ctx *gin.Context)
type UserRepo ¶
type UserRepo interface {
Create(User) error
GetByEmail(string) (*User, error)
ResetPassword(string, string, int64) error
GetPassword(int64) (string, error)
GetPasswordByEmail(string) (string, error)
}
func NewUserRepo ¶
type UserResponse ¶
type UserService ¶
type UserService struct {
User UserRepo
}
func NewUserService ¶
func NewUserService(userRepo UserRepo) *UserService
func (*UserService) CreateUser ¶
func (us *UserService) CreateUser(user UserFromRequest) error
func (*UserService) Login ¶
func (us *UserService) Login(user UserFromRequest) (*User, error)
func (*UserService) ResetPassword ¶
func (us *UserService) ResetPassword(user ResetPasswordRequest) error
Click to show internal directories.
Click to hide internal directories.