usecase

package
v0.0.0-...-ee5fcd5 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2023 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 AuthUseCase

type AuthUseCase interface {
	SignUp(payload SignUpRequest) (*models.User, error)
	SignIn(payload SignInRequest) (*Tokens, error)
	SignOut(userId uuid.UUID) (*models.User, error)
	RefreshToken(userId uuid.UUID, userRefreshToken string) (*Tokens, error)
	ParseToken(tokenString, tokenPublicKey string) (*jwt.MapClaims, error)
}

func NewAuthUseCase

func NewAuthUseCase(repo repository.UserRepository, conf *config.Config) AuthUseCase

type MockAuthUseCase

type MockAuthUseCase struct {
	mock.Mock
}

MockAuthUseCase is an autogenerated mock type for the AuthUseCase type

func NewMockAuthUseCase

func NewMockAuthUseCase(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockAuthUseCase

NewMockAuthUseCase creates a new instance of MockAuthUseCase. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockAuthUseCase) EXPECT

func (*MockAuthUseCase) ParseToken

func (_m *MockAuthUseCase) ParseToken(tokenString string, tokenPublicKey string) (*jwt.MapClaims, error)

ParseToken provides a mock function with given fields: tokenString, tokenPublicKey

func (*MockAuthUseCase) RefreshToken

func (_m *MockAuthUseCase) RefreshToken(userId uuid.UUID, userRefreshToken string) (*Tokens, error)

RefreshToken provides a mock function with given fields: userId, userRefreshToken

func (*MockAuthUseCase) SignIn

func (_m *MockAuthUseCase) SignIn(payload SignInRequest) (*Tokens, error)

SignIn provides a mock function with given fields: payload

func (*MockAuthUseCase) SignOut

func (_m *MockAuthUseCase) SignOut(userId uuid.UUID) (*models.User, error)

SignOut provides a mock function with given fields: userId

func (*MockAuthUseCase) SignUp

func (_m *MockAuthUseCase) SignUp(payload SignUpRequest) (*models.User, error)

SignUp provides a mock function with given fields: payload

type MockAuthUseCase_Expecter

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

func (*MockAuthUseCase_Expecter) ParseToken

func (_e *MockAuthUseCase_Expecter) ParseToken(tokenString interface{}, tokenPublicKey interface{}) *MockAuthUseCase_ParseToken_Call

ParseToken is a helper method to define mock.On call

  • tokenString string
  • tokenPublicKey string

func (*MockAuthUseCase_Expecter) RefreshToken

func (_e *MockAuthUseCase_Expecter) RefreshToken(userId interface{}, userRefreshToken interface{}) *MockAuthUseCase_RefreshToken_Call

RefreshToken is a helper method to define mock.On call

  • userId uuid.UUID
  • userRefreshToken string

func (*MockAuthUseCase_Expecter) SignIn

func (_e *MockAuthUseCase_Expecter) SignIn(payload interface{}) *MockAuthUseCase_SignIn_Call

SignIn is a helper method to define mock.On call

  • payload SignInRequest

func (*MockAuthUseCase_Expecter) SignOut

func (_e *MockAuthUseCase_Expecter) SignOut(userId interface{}) *MockAuthUseCase_SignOut_Call

SignOut is a helper method to define mock.On call

  • userId uuid.UUID

func (*MockAuthUseCase_Expecter) SignUp

func (_e *MockAuthUseCase_Expecter) SignUp(payload interface{}) *MockAuthUseCase_SignUp_Call

SignUp is a helper method to define mock.On call

  • payload SignUpRequest

type MockAuthUseCase_ParseToken_Call

type MockAuthUseCase_ParseToken_Call struct {
	*mock.Call
}

MockAuthUseCase_ParseToken_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ParseToken'

func (*MockAuthUseCase_ParseToken_Call) Return

func (*MockAuthUseCase_ParseToken_Call) Run

func (_c *MockAuthUseCase_ParseToken_Call) Run(run func(tokenString string, tokenPublicKey string)) *MockAuthUseCase_ParseToken_Call

func (*MockAuthUseCase_ParseToken_Call) RunAndReturn

type MockAuthUseCase_RefreshToken_Call

type MockAuthUseCase_RefreshToken_Call struct {
	*mock.Call
}

MockAuthUseCase_RefreshToken_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RefreshToken'

func (*MockAuthUseCase_RefreshToken_Call) Return

func (*MockAuthUseCase_RefreshToken_Call) Run

func (_c *MockAuthUseCase_RefreshToken_Call) Run(run func(userId uuid.UUID, userRefreshToken string)) *MockAuthUseCase_RefreshToken_Call

func (*MockAuthUseCase_RefreshToken_Call) RunAndReturn

type MockAuthUseCase_SignIn_Call

type MockAuthUseCase_SignIn_Call struct {
	*mock.Call
}

MockAuthUseCase_SignIn_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SignIn'

func (*MockAuthUseCase_SignIn_Call) Return

func (*MockAuthUseCase_SignIn_Call) Run

func (*MockAuthUseCase_SignIn_Call) RunAndReturn

type MockAuthUseCase_SignOut_Call

type MockAuthUseCase_SignOut_Call struct {
	*mock.Call
}

MockAuthUseCase_SignOut_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SignOut'

func (*MockAuthUseCase_SignOut_Call) Return

func (*MockAuthUseCase_SignOut_Call) Run

func (*MockAuthUseCase_SignOut_Call) RunAndReturn

type MockAuthUseCase_SignUp_Call

type MockAuthUseCase_SignUp_Call struct {
	*mock.Call
}

MockAuthUseCase_SignUp_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SignUp'

func (*MockAuthUseCase_SignUp_Call) Return

func (*MockAuthUseCase_SignUp_Call) Run

func (*MockAuthUseCase_SignUp_Call) RunAndReturn

type SignInRequest

type SignInRequest struct {
	Email    string `json:"email" validate:"required,email"`
	Password string `json:"password" validate:"required,min=8"`
}

type SignUpRequest

type SignUpRequest struct {
	Name            string `json:"name" validate:"required"`
	Email           string `json:"email" validate:"required,email"`
	Password        string `json:"password" validate:"required,min=8,max=32"`
	PasswordConfirm string `json:"password_confirm" validate:"required,min=8,max=32"`
}

type Tokens

type Tokens struct {
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token"`
}

Jump to

Keyboard shortcuts

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