users

package
v0.0.0-...-712712c Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2026 License: MIT Imports: 9 Imported by: 0

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

func NewUserRepo(db *sqlx.DB) UserRepo

type UserResponse

type UserResponse struct {
	ID           int64  `json:"id"`
	Name         string `json:"name"`
	Email        string `json:"email"`
	Status       bool   `json:"status"`
	Token        string `json:"token"`
	RefreshToken string `json:"refresh_token"`
}

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

Jump to

Keyboard shortcuts

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