user

package
v0.0.0-...-c913580 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var UserEventsChannel = make(chan *pb.Event)

user events channel

Functions

This section is empty.

Types

type CreateUserRequest

type CreateUserRequest struct {
	Name     string    `json:"name" validate:"required,min=6,max=100"`
	Email    string    `json:"email" validate:"required,email"`
	Password string    `json:"password" validate:"required"`
	Role     role.Role `json:"role" validate:"required,alpha"`
}

type RegisterRequest

type RegisterRequest struct {
	Name     string `json:"name" validate:"required,min=6,max=100"`
	Email    string `json:"email" validate:"required,email"`
	Password string `json:"password" validate:"required"`
}

type UserHandler

func NewUserHandler

func NewUserHandler(service UserService, validate *validator.Validate) UserHandler

func (*UserHandler) GetAllUsers

func (h *UserHandler) GetAllUsers(ctx *gin.Context)

TODO query params

func (*UserHandler) Register

func (h *UserHandler) Register(ctx *gin.Context)

type UserResponse

type UserResponse struct {
	Uuid      uuid.UUID  `json:"uuid"`
	Name      string     `json:"name"`
	Email     string     `json:"email"`
	IsActive  bool       `json:"isActive"`
	ImageID   string     `json:"imageId"`
	ImageUrl  string     `json:"imageUrl"`
	Role      role.Role  `json:"role"`
	CreatedAt *time.Time `json:"createdAt"`
	UpdatedAt *time.Time `json:"updatedAt"`
}

func ToUserResponse

func ToUserResponse(user db.User) UserResponse

func ToUserResponseList

func ToUserResponseList(users []db.User) []UserResponse

type UserService

type UserService interface {
	Create(ctx context.Context, req CreateUserRequest) (db.User, error)
	GetAll(ctx context.Context) ([]db.User, error)
	GetByEmail(ctx context.Context, email string) (db.User, error)
	GetByID(ctx context.Context, id int64) (db.User, error)
	CheckPassword(password string, hashedPassword string) error
}

func NewUserService

func NewUserService(datastore db.DataStore) UserService

type UserServiceImpl

type UserServiceImpl struct {
	// contains filtered or unexported fields
}

func (*UserServiceImpl) CheckPassword

func (service *UserServiceImpl) CheckPassword(password string, hashedPassword string) error

func (*UserServiceImpl) Create

func (service *UserServiceImpl) Create(ctx context.Context, req CreateUserRequest) (db.User, error)

func (*UserServiceImpl) GetAll

func (service *UserServiceImpl) GetAll(ctx context.Context) ([]db.User, error)

func (*UserServiceImpl) GetByEmail

func (service *UserServiceImpl) GetByEmail(ctx context.Context, email string) (db.User, error)

func (*UserServiceImpl) GetByID

func (service *UserServiceImpl) GetByID(ctx context.Context, id int64) (db.User, error)

Jump to

Keyboard shortcuts

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