user

package
v0.0.0-...-36de035 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthenticateInput

type AuthenticateInput struct {
	Email    string `json:"email"`
	Password string `json:"password"`
}

type CreateUserInput

type CreateUserInput struct {
	Email    string `json:"email"`
	Password string `json:"password"`
	Name     string `json:"name"`
	Phone    string `json:"phone"`
}

type IUserRepository

type IUserRepository interface {
	CreateUser(user *User) (insertedID string, err error)
	FindByEmail(email string) (*User, error)
	FindByEmailWithPassword(email string) (*User, error)
	FindById(id string) (*User, error)
}

type IUserUseCase

type IUserUseCase interface {
	CreateUser(CreateUserInput) (*User, error)
	Authenticate(AuthenticateInput) (*User, error)
}

type User

type User struct {
	ID        uuid.UUID `json:"id"`
	Name      string    `json:"name"`
	Email     string    `json:"email"`
	Phone     string    `json:"phone"`
	CreatedAt time.Time `json:"created_at"`
	Password  string    `json:"password"`
}

func NewUser

func NewUser(email string, password string, name string, phone string) (*User, error)

func (*User) ComparePassword

func (u *User) ComparePassword(password string) bool

type UserHandler

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

func NewUserHandler

func NewUserHandler(useCase IUserUseCase) *UserHandler

func UserFactory

func UserFactory(db *sql.DB) *UserHandler

func (*UserHandler) Authenticate

func (uh *UserHandler) Authenticate(c *fiber.Ctx) error

func (*UserHandler) CreateUser

func (uh *UserHandler) CreateUser(c *fiber.Ctx) error

type UserRepository

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

func NewUserRepository

func NewUserRepository(db *sql.DB) *UserRepository

func (*UserRepository) CreateUser

func (ur *UserRepository) CreateUser(user *User) (insertedID string, err error)

func (*UserRepository) FindByEmail

func (ur *UserRepository) FindByEmail(email string) (*User, error)

func (*UserRepository) FindByEmailWithPassword

func (ur *UserRepository) FindByEmailWithPassword(email string) (*User, error)

func (*UserRepository) FindById

func (ur *UserRepository) FindById(id string) (*User, error)

type UserUseCase

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

func NewUserUseCase

func NewUserUseCase(repo IUserRepository) *UserUseCase

func (*UserUseCase) Authenticate

func (uc *UserUseCase) Authenticate(input AuthenticateInput) (*User, error)

func (*UserUseCase) CreateUser

func (uc *UserUseCase) CreateUser(input CreateUserInput) (*User, error)

Jump to

Keyboard shortcuts

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