userservice

package
v0.0.0-...-c477d60 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2019 License: GPL-3.0 Imports: 15 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

type Service struct {
	*dbservice.DB
}

Service defines service type

func NewService

func NewService(db *dbservice.DB) *Service

NewService factory for Service

func (*Service) ChangePassword

func (db *Service) ChangePassword(user *datatype.User, newPassword string, password string) error

ChangePassword changes user password

func (*Service) ConfirmPassResetToken

func (db *Service) ConfirmPassResetToken(
	userID datatype.ID,
	token string,
	newPassword string,
) error

ConfirmPassResetToken validates a pass-reset token and update user's password

func (*Service) ConfirmUserEmailChange

func (db *Service) ConfirmUserEmailChange(userID datatype.ID, token string) bool

ConfirmUserEmailChange confirms email change and changes user's email if successful

func (*Service) CreateChangeEmailConfirmation

func (db *Service) CreateChangeEmailConfirmation(
	user *datatype.User,
	email string,
	password string,
) (*datatype.EmailChangeConfirmation, error)

CreateChangeEmailConfirmation creates a new email change confirmation db entry

func (*Service) DeletePassResetToken

func (db *Service) DeletePassResetToken(userID datatype.ID, token string) bool

DeletePassResetToken deletes a pass-reset token

func (*Service) FindByEmail

func (db *Service) FindByEmail(email string) (*datatype.User, error)

FindByEmail finds a user by email

func (*Service) FindByID

func (db *Service) FindByID(id datatype.ID) (*datatype.User, error)

FindByID finds a user by id

func (*Service) FindUserBalance

func (db *Service) FindUserBalance(
	userID datatype.ID,
	currecncyID datatype.ID,
) (
	decimaldt.Decimal,
	decimaldt.Decimal,
	error,
)

FindUserBalance finds user's balance of given currecncy

func (*Service) FindUserBalances

func (db *Service) FindUserBalances(id datatype.ID) ([]datatype.Balance, error)

FindUserBalances finds all balances belonging to given user

func (*Service) GetBalances

func (db *Service) GetBalances(userID datatype.ID) ([]datatype.Balance, error)

GetBalaces fetches user balaces

func (*Service) GetPerson

func (db *Service) GetPerson(userID datatype.ID) (*datatype.Person, error)

GetPerson finds a person with stats

func (*Service) IsEmailRegistered

func (db *Service) IsEmailRegistered(email string) bool

IsEmailRegistered checks whether email is already registered or not

func (*Service) NewPassResetTokenByEmail

func (db *Service) NewPassResetTokenByEmail(email string) (*datatype.UserResetToken, error)

NewPassResetTokenByEmail creates a new reset password token for given email

func (*Service) Register

func (db *Service) Register(
	email,
	name string,
	ethereumAddress string,
	password string,
	agreeToTerms bool,
) (*datatype.User, error)

Register Registers a new user

func (*Service) UpdateProfileImage

func (db *Service) UpdateProfileImage(
	user *datatype.User, imageURL string,
) error

UpdateProfileImage changes user profile image url

func (*Service) Validate

func (db *Service) Validate(email string, password string) error

TODO do we need this? maybe get rid of it Validate validates email and password for signup

Jump to

Keyboard shortcuts

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