user

package
v0.0.0-...-8ddd878 Latest Latest
Warning

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

Go to latest
Published: May 24, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUserCommentMissing = errors.New("comment is missing")

Functions

func NewService

func NewService(repo Repository) *service

NewService creates a new user service.

func ValidateEmail

func ValidateEmail(email string) error

ValidateEmail validates the email string.

func ValidatePassword

func ValidatePassword(password string) error

ValidatePassword validates the password string.

Types

type MockRepository

type MockRepository struct {
	mock.Mock
}

MockRepository is an autogenerated mock type for the Repository type

func NewMockRepository

func NewMockRepository(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockRepository

NewMockRepository creates a new instance of MockRepository. 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 (*MockRepository) CreateUser

func (_m *MockRepository) CreateUser(ctx context.Context, orgID int64, email string, passwordHash string, isOwner bool) (User, error)

CreateUser provides a mock function with given fields: ctx, orgID, email, passwordHash, isOwner

func (*MockRepository) DeleteUser

func (_m *MockRepository) DeleteUser(ctx context.Context, id int64) error

DeleteUser provides a mock function with given fields: ctx, id

func (*MockRepository) DisableUser

func (_m *MockRepository) DisableUser(ctx context.Context, id int64, comment string) error

DisableUser provides a mock function with given fields: ctx, id, comment

func (*MockRepository) EXPECT

func (*MockRepository) EnableUser

func (_m *MockRepository) EnableUser(ctx context.Context, id int64, comment string) error

EnableUser provides a mock function with given fields: ctx, id, comment

func (*MockRepository) GenerateAPIToken

func (_m *MockRepository) GenerateAPIToken(ctx context.Context, id int64) error

GenerateAPIToken provides a mock function with given fields: ctx, id

func (*MockRepository) GetUserByAPIToken

func (_m *MockRepository) GetUserByAPIToken(ctx context.Context, apiToken string) (User, error)

GetUserByAPIToken provides a mock function with given fields: ctx, apiToken

func (*MockRepository) GetUserByID

func (_m *MockRepository) GetUserByID(ctx context.Context, id int64) (User, error)

GetUserByID provides a mock function with given fields: ctx, id

func (*MockRepository) GetUserByOrgIDEmail

func (_m *MockRepository) GetUserByOrgIDEmail(ctx context.Context, orgID int64, email string) (User, error)

GetUserByOrgIDEmail provides a mock function with given fields: ctx, orgID, email

func (*MockRepository) GetUserByOrgSubdomainAPIToken

func (_m *MockRepository) GetUserByOrgSubdomainAPIToken(ctx context.Context, orgSubdomain string, apiToken string) (User, error)

GetUserByOrgSubdomainAPIToken provides a mock function with given fields: ctx, orgSubdomain, apiToken

func (*MockRepository) GetUserByOrgSubdomainEmail

func (_m *MockRepository) GetUserByOrgSubdomainEmail(ctx context.Context, orgSubdomain string, email string) (User, error)

GetUserByOrgSubdomainEmail provides a mock function with given fields: ctx, orgSubdomain, email

func (*MockRepository) ResetAPIToken

func (_m *MockRepository) ResetAPIToken(ctx context.Context, id int64) error

ResetAPIToken provides a mock function with given fields: ctx, id

func (*MockRepository) ResetPassword

func (_m *MockRepository) ResetPassword(ctx context.Context, id int64, passwordHash string) error

ResetPassword provides a mock function with given fields: ctx, id, passwordHash

func (*MockRepository) SetEmailVerified

func (_m *MockRepository) SetEmailVerified(ctx context.Context, id int64) error

SetEmailVerified provides a mock function with given fields: ctx, id

type MockRepository_CreateUser_Call

type MockRepository_CreateUser_Call struct {
	*mock.Call
}

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

func (*MockRepository_CreateUser_Call) Return

func (*MockRepository_CreateUser_Call) Run

func (_c *MockRepository_CreateUser_Call) Run(run func(ctx context.Context, orgID int64, email string, passwordHash string, isOwner bool)) *MockRepository_CreateUser_Call

func (*MockRepository_CreateUser_Call) RunAndReturn

type MockRepository_DeleteUser_Call

type MockRepository_DeleteUser_Call struct {
	*mock.Call
}

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

func (*MockRepository_DeleteUser_Call) Return

func (*MockRepository_DeleteUser_Call) Run

func (*MockRepository_DeleteUser_Call) RunAndReturn

type MockRepository_DisableUser_Call

type MockRepository_DisableUser_Call struct {
	*mock.Call
}

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

func (*MockRepository_DisableUser_Call) Return

func (*MockRepository_DisableUser_Call) Run

func (*MockRepository_DisableUser_Call) RunAndReturn

type MockRepository_EnableUser_Call

type MockRepository_EnableUser_Call struct {
	*mock.Call
}

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

func (*MockRepository_EnableUser_Call) Return

func (*MockRepository_EnableUser_Call) Run

func (*MockRepository_EnableUser_Call) RunAndReturn

type MockRepository_Expecter

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

func (*MockRepository_Expecter) CreateUser

func (_e *MockRepository_Expecter) CreateUser(ctx interface{}, orgID interface{}, email interface{}, passwordHash interface{}, isOwner interface{}) *MockRepository_CreateUser_Call

CreateUser is a helper method to define mock.On call

  • ctx context.Context
  • orgID int64
  • email string
  • passwordHash string
  • isOwner bool

func (*MockRepository_Expecter) DeleteUser

func (_e *MockRepository_Expecter) DeleteUser(ctx interface{}, id interface{}) *MockRepository_DeleteUser_Call

DeleteUser is a helper method to define mock.On call

  • ctx context.Context
  • id int64

func (*MockRepository_Expecter) DisableUser

func (_e *MockRepository_Expecter) DisableUser(ctx interface{}, id interface{}, comment interface{}) *MockRepository_DisableUser_Call

DisableUser is a helper method to define mock.On call

  • ctx context.Context
  • id int64
  • comment string

func (*MockRepository_Expecter) EnableUser

func (_e *MockRepository_Expecter) EnableUser(ctx interface{}, id interface{}, comment interface{}) *MockRepository_EnableUser_Call

EnableUser is a helper method to define mock.On call

  • ctx context.Context
  • id int64
  • comment string

func (*MockRepository_Expecter) GenerateAPIToken

func (_e *MockRepository_Expecter) GenerateAPIToken(ctx interface{}, id interface{}) *MockRepository_GenerateAPIToken_Call

GenerateAPIToken is a helper method to define mock.On call

  • ctx context.Context
  • id int64

func (*MockRepository_Expecter) GetUserByAPIToken

func (_e *MockRepository_Expecter) GetUserByAPIToken(ctx interface{}, apiToken interface{}) *MockRepository_GetUserByAPIToken_Call

GetUserByAPIToken is a helper method to define mock.On call

  • ctx context.Context
  • apiToken string

func (*MockRepository_Expecter) GetUserByID

func (_e *MockRepository_Expecter) GetUserByID(ctx interface{}, id interface{}) *MockRepository_GetUserByID_Call

GetUserByID is a helper method to define mock.On call

  • ctx context.Context
  • id int64

func (*MockRepository_Expecter) GetUserByOrgIDEmail

func (_e *MockRepository_Expecter) GetUserByOrgIDEmail(ctx interface{}, orgID interface{}, email interface{}) *MockRepository_GetUserByOrgIDEmail_Call

GetUserByOrgIDEmail is a helper method to define mock.On call

  • ctx context.Context
  • orgID int64
  • email string

func (*MockRepository_Expecter) GetUserByOrgSubdomainAPIToken

func (_e *MockRepository_Expecter) GetUserByOrgSubdomainAPIToken(ctx interface{}, orgSubdomain interface{}, apiToken interface{}) *MockRepository_GetUserByOrgSubdomainAPIToken_Call

GetUserByOrgSubdomainAPIToken is a helper method to define mock.On call

  • ctx context.Context
  • orgSubdomain string
  • apiToken string

func (*MockRepository_Expecter) GetUserByOrgSubdomainEmail

func (_e *MockRepository_Expecter) GetUserByOrgSubdomainEmail(ctx interface{}, orgSubdomain interface{}, email interface{}) *MockRepository_GetUserByOrgSubdomainEmail_Call

GetUserByOrgSubdomainEmail is a helper method to define mock.On call

  • ctx context.Context
  • orgSubdomain string
  • email string

func (*MockRepository_Expecter) ResetAPIToken

func (_e *MockRepository_Expecter) ResetAPIToken(ctx interface{}, id interface{}) *MockRepository_ResetAPIToken_Call

ResetAPIToken is a helper method to define mock.On call

  • ctx context.Context
  • id int64

func (*MockRepository_Expecter) ResetPassword

func (_e *MockRepository_Expecter) ResetPassword(ctx interface{}, id interface{}, passwordHash interface{}) *MockRepository_ResetPassword_Call

ResetPassword is a helper method to define mock.On call

  • ctx context.Context
  • id int64
  • passwordHash string

func (*MockRepository_Expecter) SetEmailVerified

func (_e *MockRepository_Expecter) SetEmailVerified(ctx interface{}, id interface{}) *MockRepository_SetEmailVerified_Call

SetEmailVerified is a helper method to define mock.On call

  • ctx context.Context
  • id int64

type MockRepository_GenerateAPIToken_Call

type MockRepository_GenerateAPIToken_Call struct {
	*mock.Call
}

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

func (*MockRepository_GenerateAPIToken_Call) Return

func (*MockRepository_GenerateAPIToken_Call) Run

func (*MockRepository_GenerateAPIToken_Call) RunAndReturn

type MockRepository_GetUserByAPIToken_Call

type MockRepository_GetUserByAPIToken_Call struct {
	*mock.Call
}

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

func (*MockRepository_GetUserByAPIToken_Call) Return

func (*MockRepository_GetUserByAPIToken_Call) Run

func (*MockRepository_GetUserByAPIToken_Call) RunAndReturn

type MockRepository_GetUserByID_Call

type MockRepository_GetUserByID_Call struct {
	*mock.Call
}

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

func (*MockRepository_GetUserByID_Call) Return

func (*MockRepository_GetUserByID_Call) Run

func (*MockRepository_GetUserByID_Call) RunAndReturn

type MockRepository_GetUserByOrgIDEmail_Call

type MockRepository_GetUserByOrgIDEmail_Call struct {
	*mock.Call
}

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

func (*MockRepository_GetUserByOrgIDEmail_Call) Return

func (*MockRepository_GetUserByOrgIDEmail_Call) Run

func (*MockRepository_GetUserByOrgIDEmail_Call) RunAndReturn

type MockRepository_GetUserByOrgSubdomainAPIToken_Call

type MockRepository_GetUserByOrgSubdomainAPIToken_Call struct {
	*mock.Call
}

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

func (*MockRepository_GetUserByOrgSubdomainAPIToken_Call) Return

func (*MockRepository_GetUserByOrgSubdomainAPIToken_Call) Run

func (*MockRepository_GetUserByOrgSubdomainAPIToken_Call) RunAndReturn

type MockRepository_GetUserByOrgSubdomainEmail_Call

type MockRepository_GetUserByOrgSubdomainEmail_Call struct {
	*mock.Call
}

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

func (*MockRepository_GetUserByOrgSubdomainEmail_Call) Return

func (*MockRepository_GetUserByOrgSubdomainEmail_Call) Run

func (*MockRepository_GetUserByOrgSubdomainEmail_Call) RunAndReturn

type MockRepository_ResetAPIToken_Call

type MockRepository_ResetAPIToken_Call struct {
	*mock.Call
}

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

func (*MockRepository_ResetAPIToken_Call) Return

func (*MockRepository_ResetAPIToken_Call) Run

func (*MockRepository_ResetAPIToken_Call) RunAndReturn

type MockRepository_ResetPassword_Call

type MockRepository_ResetPassword_Call struct {
	*mock.Call
}

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

func (*MockRepository_ResetPassword_Call) Return

func (*MockRepository_ResetPassword_Call) Run

func (*MockRepository_ResetPassword_Call) RunAndReturn

type MockRepository_SetEmailVerified_Call

type MockRepository_SetEmailVerified_Call struct {
	*mock.Call
}

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

func (*MockRepository_SetEmailVerified_Call) Return

func (*MockRepository_SetEmailVerified_Call) Run

func (*MockRepository_SetEmailVerified_Call) RunAndReturn

type MockService

type MockService struct {
	mock.Mock
}

MockService is an autogenerated mock type for the Service type

func NewMockService

func NewMockService(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockService

NewMockService creates a new instance of MockService. 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 (*MockService) CreateOwner

func (_m *MockService) CreateOwner(ctx context.Context, orgID int64, email string, password string) (User, error)

CreateOwner provides a mock function with given fields: ctx, orgID, email, password

func (*MockService) CreateUser

func (_m *MockService) CreateUser(ctx context.Context, orgID int64, email string, password string) (User, error)

CreateUser provides a mock function with given fields: ctx, orgID, email, password

func (*MockService) DeleteUser

func (_m *MockService) DeleteUser(ctx context.Context, id int64) error

DeleteUser provides a mock function with given fields: ctx, id

func (*MockService) DisableUser

func (_m *MockService) DisableUser(ctx context.Context, id int64, comment string) error

DisableUser provides a mock function with given fields: ctx, id, comment

func (*MockService) EXPECT

func (_m *MockService) EXPECT() *MockService_Expecter

func (*MockService) EnableUser

func (_m *MockService) EnableUser(ctx context.Context, id int64, comment string) error

EnableUser provides a mock function with given fields: ctx, id, comment

func (*MockService) GenerateAPIToken

func (_m *MockService) GenerateAPIToken(ctx context.Context, id int64) error

GenerateAPIToken provides a mock function with given fields: ctx, id

func (*MockService) GetUserByAPIToken

func (_m *MockService) GetUserByAPIToken(ctx context.Context, apiToken string) (User, error)

GetUserByAPIToken provides a mock function with given fields: ctx, apiToken

func (*MockService) GetUserByID

func (_m *MockService) GetUserByID(ctx context.Context, id int64) (User, error)

GetUserByID provides a mock function with given fields: ctx, id

func (*MockService) GetUserByOrgIDEmail

func (_m *MockService) GetUserByOrgIDEmail(ctx context.Context, orgID int64, email string) (User, error)

GetUserByOrgIDEmail provides a mock function with given fields: ctx, orgID, email

func (*MockService) GetUserByOrgSubdomainAPIToken

func (_m *MockService) GetUserByOrgSubdomainAPIToken(ctx context.Context, orgSubdomain string, apiToken string) (User, error)

GetUserByOrgSubdomainAPIToken provides a mock function with given fields: ctx, orgSubdomain, apiToken

func (*MockService) GetUserByOrgSubdomainEmail

func (_m *MockService) GetUserByOrgSubdomainEmail(ctx context.Context, orgSubdomain string, email string) (User, error)

GetUserByOrgSubdomainEmail provides a mock function with given fields: ctx, orgSubdomain, email

func (*MockService) ResetAPIToken

func (_m *MockService) ResetAPIToken(ctx context.Context, id int64) error

ResetAPIToken provides a mock function with given fields: ctx, id

func (*MockService) ResetPassword

func (_m *MockService) ResetPassword(ctx context.Context, id int64, newPassword string) error

ResetPassword provides a mock function with given fields: ctx, id, newPassword

func (*MockService) SetEmailVerified

func (_m *MockService) SetEmailVerified(ctx context.Context, id int64) error

SetEmailVerified provides a mock function with given fields: ctx, id

type MockService_CreateOwner_Call

type MockService_CreateOwner_Call struct {
	*mock.Call
}

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

func (*MockService_CreateOwner_Call) Return

func (*MockService_CreateOwner_Call) Run

func (_c *MockService_CreateOwner_Call) Run(run func(ctx context.Context, orgID int64, email string, password string)) *MockService_CreateOwner_Call

func (*MockService_CreateOwner_Call) RunAndReturn

type MockService_CreateUser_Call

type MockService_CreateUser_Call struct {
	*mock.Call
}

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

func (*MockService_CreateUser_Call) Return

func (*MockService_CreateUser_Call) Run

func (_c *MockService_CreateUser_Call) Run(run func(ctx context.Context, orgID int64, email string, password string)) *MockService_CreateUser_Call

func (*MockService_CreateUser_Call) RunAndReturn

type MockService_DeleteUser_Call

type MockService_DeleteUser_Call struct {
	*mock.Call
}

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

func (*MockService_DeleteUser_Call) Return

func (*MockService_DeleteUser_Call) Run

func (*MockService_DeleteUser_Call) RunAndReturn

type MockService_DisableUser_Call

type MockService_DisableUser_Call struct {
	*mock.Call
}

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

func (*MockService_DisableUser_Call) Return

func (*MockService_DisableUser_Call) Run

func (*MockService_DisableUser_Call) RunAndReturn

type MockService_EnableUser_Call

type MockService_EnableUser_Call struct {
	*mock.Call
}

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

func (*MockService_EnableUser_Call) Return

func (*MockService_EnableUser_Call) Run

func (*MockService_EnableUser_Call) RunAndReturn

type MockService_Expecter

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

func (*MockService_Expecter) CreateOwner

func (_e *MockService_Expecter) CreateOwner(ctx interface{}, orgID interface{}, email interface{}, password interface{}) *MockService_CreateOwner_Call

CreateOwner is a helper method to define mock.On call

  • ctx context.Context
  • orgID int64
  • email string
  • password string

func (*MockService_Expecter) CreateUser

func (_e *MockService_Expecter) CreateUser(ctx interface{}, orgID interface{}, email interface{}, password interface{}) *MockService_CreateUser_Call

CreateUser is a helper method to define mock.On call

  • ctx context.Context
  • orgID int64
  • email string
  • password string

func (*MockService_Expecter) DeleteUser

func (_e *MockService_Expecter) DeleteUser(ctx interface{}, id interface{}) *MockService_DeleteUser_Call

DeleteUser is a helper method to define mock.On call

  • ctx context.Context
  • id int64

func (*MockService_Expecter) DisableUser

func (_e *MockService_Expecter) DisableUser(ctx interface{}, id interface{}, comment interface{}) *MockService_DisableUser_Call

DisableUser is a helper method to define mock.On call

  • ctx context.Context
  • id int64
  • comment string

func (*MockService_Expecter) EnableUser

func (_e *MockService_Expecter) EnableUser(ctx interface{}, id interface{}, comment interface{}) *MockService_EnableUser_Call

EnableUser is a helper method to define mock.On call

  • ctx context.Context
  • id int64
  • comment string

func (*MockService_Expecter) GenerateAPIToken

func (_e *MockService_Expecter) GenerateAPIToken(ctx interface{}, id interface{}) *MockService_GenerateAPIToken_Call

GenerateAPIToken is a helper method to define mock.On call

  • ctx context.Context
  • id int64

func (*MockService_Expecter) GetUserByAPIToken

func (_e *MockService_Expecter) GetUserByAPIToken(ctx interface{}, apiToken interface{}) *MockService_GetUserByAPIToken_Call

GetUserByAPIToken is a helper method to define mock.On call

  • ctx context.Context
  • apiToken string

func (*MockService_Expecter) GetUserByID

func (_e *MockService_Expecter) GetUserByID(ctx interface{}, id interface{}) *MockService_GetUserByID_Call

GetUserByID is a helper method to define mock.On call

  • ctx context.Context
  • id int64

func (*MockService_Expecter) GetUserByOrgIDEmail

func (_e *MockService_Expecter) GetUserByOrgIDEmail(ctx interface{}, orgID interface{}, email interface{}) *MockService_GetUserByOrgIDEmail_Call

GetUserByOrgIDEmail is a helper method to define mock.On call

  • ctx context.Context
  • orgID int64
  • email string

func (*MockService_Expecter) GetUserByOrgSubdomainAPIToken

func (_e *MockService_Expecter) GetUserByOrgSubdomainAPIToken(ctx interface{}, orgSubdomain interface{}, apiToken interface{}) *MockService_GetUserByOrgSubdomainAPIToken_Call

GetUserByOrgSubdomainAPIToken is a helper method to define mock.On call

  • ctx context.Context
  • orgSubdomain string
  • apiToken string

func (*MockService_Expecter) GetUserByOrgSubdomainEmail

func (_e *MockService_Expecter) GetUserByOrgSubdomainEmail(ctx interface{}, orgSubdomain interface{}, email interface{}) *MockService_GetUserByOrgSubdomainEmail_Call

GetUserByOrgSubdomainEmail is a helper method to define mock.On call

  • ctx context.Context
  • orgSubdomain string
  • email string

func (*MockService_Expecter) ResetAPIToken

func (_e *MockService_Expecter) ResetAPIToken(ctx interface{}, id interface{}) *MockService_ResetAPIToken_Call

ResetAPIToken is a helper method to define mock.On call

  • ctx context.Context
  • id int64

func (*MockService_Expecter) ResetPassword

func (_e *MockService_Expecter) ResetPassword(ctx interface{}, id interface{}, newPassword interface{}) *MockService_ResetPassword_Call

ResetPassword is a helper method to define mock.On call

  • ctx context.Context
  • id int64
  • newPassword string

func (*MockService_Expecter) SetEmailVerified

func (_e *MockService_Expecter) SetEmailVerified(ctx interface{}, id interface{}) *MockService_SetEmailVerified_Call

SetEmailVerified is a helper method to define mock.On call

  • ctx context.Context
  • id int64

type MockService_GenerateAPIToken_Call

type MockService_GenerateAPIToken_Call struct {
	*mock.Call
}

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

func (*MockService_GenerateAPIToken_Call) Return

func (*MockService_GenerateAPIToken_Call) Run

func (*MockService_GenerateAPIToken_Call) RunAndReturn

type MockService_GetUserByAPIToken_Call

type MockService_GetUserByAPIToken_Call struct {
	*mock.Call
}

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

func (*MockService_GetUserByAPIToken_Call) Return

func (*MockService_GetUserByAPIToken_Call) Run

func (*MockService_GetUserByAPIToken_Call) RunAndReturn

type MockService_GetUserByID_Call

type MockService_GetUserByID_Call struct {
	*mock.Call
}

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

func (*MockService_GetUserByID_Call) Return

func (*MockService_GetUserByID_Call) Run

func (*MockService_GetUserByID_Call) RunAndReturn

type MockService_GetUserByOrgIDEmail_Call

type MockService_GetUserByOrgIDEmail_Call struct {
	*mock.Call
}

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

func (*MockService_GetUserByOrgIDEmail_Call) Return

func (*MockService_GetUserByOrgIDEmail_Call) Run

func (*MockService_GetUserByOrgIDEmail_Call) RunAndReturn

type MockService_GetUserByOrgSubdomainAPIToken_Call

type MockService_GetUserByOrgSubdomainAPIToken_Call struct {
	*mock.Call
}

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

func (*MockService_GetUserByOrgSubdomainAPIToken_Call) Return

func (*MockService_GetUserByOrgSubdomainAPIToken_Call) Run

func (*MockService_GetUserByOrgSubdomainAPIToken_Call) RunAndReturn

type MockService_GetUserByOrgSubdomainEmail_Call

type MockService_GetUserByOrgSubdomainEmail_Call struct {
	*mock.Call
}

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

func (*MockService_GetUserByOrgSubdomainEmail_Call) Return

func (*MockService_GetUserByOrgSubdomainEmail_Call) Run

func (*MockService_GetUserByOrgSubdomainEmail_Call) RunAndReturn

type MockService_ResetAPIToken_Call

type MockService_ResetAPIToken_Call struct {
	*mock.Call
}

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

func (*MockService_ResetAPIToken_Call) Return

func (*MockService_ResetAPIToken_Call) Run

func (*MockService_ResetAPIToken_Call) RunAndReturn

type MockService_ResetPassword_Call

type MockService_ResetPassword_Call struct {
	*mock.Call
}

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

func (*MockService_ResetPassword_Call) Return

func (*MockService_ResetPassword_Call) Run

func (*MockService_ResetPassword_Call) RunAndReturn

type MockService_SetEmailVerified_Call

type MockService_SetEmailVerified_Call struct {
	*mock.Call
}

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

func (*MockService_SetEmailVerified_Call) Return

func (*MockService_SetEmailVerified_Call) Run

func (*MockService_SetEmailVerified_Call) RunAndReturn

type Repository

type Repository interface {
	// GetUserByID returns a user by its ID.
	GetUserByID(ctx context.Context, id int64) (User, error)

	// GetUserByAPIToken returns a user by its API token.
	GetUserByAPIToken(ctx context.Context, apiToken string) (User, error)

	// GetUserByOrgSubdomainAPIToken returns a user of organization by its org subdomain and api token.
	GetUserByOrgSubdomainAPIToken(ctx context.Context, orgSubdomain, apiToken string) (User, error)

	// GetUserByOrgIDEmail returns a user of organization by its org id and email.
	GetUserByOrgIDEmail(ctx context.Context, orgID int64, email string) (User, error)

	// GetUserByOrgSubdomainEmail returns a user of organization by its org subdomain and email.
	GetUserByOrgSubdomainEmail(ctx context.Context, orgSubdomain, email string) (User, error)

	// CreateUser creates a new user.
	CreateUser(ctx context.Context, orgID int64, email, passwordHash string, isOwner bool) (User, error)

	// ResetPassword resets the password of a user.
	ResetPassword(ctx context.Context, id int64, passwordHash string) error

	// DeleteUser deletes a user by its ID.
	DeleteUser(ctx context.Context, id int64) error

	// DisableUser disables a user by its ID.
	DisableUser(ctx context.Context, id int64, comment string) error

	// EnableUser enables a user by its ID.
	EnableUser(ctx context.Context, id int64, comment string) error

	// GenerateAPIToken generates a new API token for a user.
	GenerateAPIToken(ctx context.Context, id int64) error

	// ResetAPIToken resets the API token of a user.
	ResetAPIToken(ctx context.Context, id int64) error

	// SetEmailVerified sets the email_verified flag of a user.
	SetEmailVerified(ctx context.Context, id int64) error
}

func NewRepository

func NewRepository(db database.Database) Repository

type Service

type Service interface {
	// GetUserByID returns a user by its ID.
	GetUserByID(ctx context.Context, id int64) (User, error)

	// GetUserByAPIToken returns a user by its API token.
	GetUserByAPIToken(ctx context.Context, apiToken string) (User, error)

	// GetUserByOrgSubdomainAPIToken returns a user of organization by its org subdomain and api token.
	GetUserByOrgSubdomainAPIToken(ctx context.Context, orgSubdomain, apiToken string) (User, error)

	// GetUserByOrgIDEmail returns a user of organization by its org id and email.
	GetUserByOrgIDEmail(ctx context.Context, orgID int64, email string) (User, error)

	// GetUserByOrgSubdomainEmail returns a user of organization by its org subdomain and email.
	GetUserByOrgSubdomainEmail(ctx context.Context, orgSubdomain, email string) (User, error)

	// CreateUser creates a new user.
	CreateUser(ctx context.Context, orgID int64, email, password string) (User, error)

	// CreateOwner creates a new owner user.
	CreateOwner(ctx context.Context, orgID int64, email, password string) (User, error)

	// ResetPassword resets the password of a user.
	ResetPassword(ctx context.Context, id int64, newPassword string) error

	// DeleteUser deletes a user by its ID.
	DeleteUser(ctx context.Context, id int64) error

	// DisableUser disables a user by its ID.
	DisableUser(ctx context.Context, id int64, comment string) error

	// EnableUser enables a user by its ID.
	EnableUser(ctx context.Context, id int64, comment string) error

	// GenerateAPIToken generates a new API token for a user.
	GenerateAPIToken(ctx context.Context, id int64) error

	// ResetAPIToken resets the API token of a user.
	ResetAPIToken(ctx context.Context, id int64) error

	// SetEmailVerified sets the email_verified flag of a user.
	SetEmailVerified(ctx context.Context, id int64) error
}

type User

type User struct {
	// ID is the unique identifier of the user.
	ID int64 `db:"user_id"`

	// OrganizationID is the reference to the organization the user belongs to.
	OrganizationID int64 `db:"organization_id"`

	// Email is the email address of the user.
	Email string `db:"email"`

	// PasswordHash is the hashed password of the user.
	PasswordHash string `db:"password_hash"`

	// APIToken is the token used to authenticate the user for API requests.
	APIToken *string `db:"api_token"`

	// IsOwner represents whether the user is the owner of the organization.
	IsOwner bool `db:"is_owner"`

	// IsEmailVerified represents whether the user's email is verified.
	IsEmailVerified bool `db:"is_email_verified"`

	// DisabledAt is the timestamp when the user was disabled.
	DisabledAt *time.Time `db:"disabled_at"`

	// Comment represents any additional information about the user's current state.
	Comment *string `db:"comment"`

	base.Timestamps
}

User represents a user.

Jump to

Keyboard shortcuts

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