services

package
v0.0.0-...-a797973 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

type Auth struct {
	JWTIssuer     string
	SigningMethod jwt.SigningMethod
	PrivateKey    *rsa.PrivateKey
	UserAccounts  repositories.IUserAccounts
}

func (*Auth) Authenticate

func (a *Auth) Authenticate(username, password string) (bool, error)

func (*Auth) CreateAuthToken

func (a *Auth) CreateAuthToken(username string) (string, error)

func (*Auth) ValidateSession

func (a *Auth) ValidateSession(tokenString string) (*jwt.Token, error)

type BankAccounts

type BankAccounts struct {
	Repository repositories.IBankAccounts
}

func (*BankAccounts) Create

func (ba *BankAccounts) Create(budgetID string, name string) (*models.BankAccount, error)

func (*BankAccounts) Delete

func (ba *BankAccounts) Delete(id string) error

func (*BankAccounts) ExistsByID

func (ba *BankAccounts) ExistsByID(id string) (bool, error)

func (*BankAccounts) GetAll

func (ba *BankAccounts) GetAll(budgetID string) ([]*models.BankAccount, error)

func (*BankAccounts) GetByID

func (ba *BankAccounts) GetByID(id string) (*models.BankAccount, error)

type Budgets

type Budgets struct {
	RBudgets repositories.IBudgets
}

func (*Budgets) BelongsTo

func (b *Budgets) BelongsTo(userAccountID, budgetID string) (bool, error)

func (*Budgets) Create

func (b *Budgets) Create(userAccountID, name string) (*models.Budget, error)

func (*Budgets) Delete

func (b *Budgets) Delete(id string) error

func (*Budgets) ExistsByID

func (b *Budgets) ExistsByID(id string) (bool, error)

func (*Budgets) ExistsByUserIDAndName

func (b *Budgets) ExistsByUserIDAndName(userAccountID, name string) (bool, error)

func (*Budgets) GetAllByUserAccountID

func (b *Budgets) GetAllByUserAccountID(userAccountID string) ([]*models.Budget, error)

func (*Budgets) GetByID

func (b *Budgets) GetByID(id string) (*models.Budget, error)

func (*Budgets) GetByUserIDAndName

func (b *Budgets) GetByUserIDAndName(userAccountID, name string) (*models.Budget, error)

type IAuth

type IAuth interface {
	ValidateSession(tokenString string) (*jwt.Token, error)
	Authenticate(username, password string) (bool, error)
	CreateAuthToken(username string) (string, error)
}

type IBankAccounts

type IBankAccounts interface {
	ExistsByID(id string) (bool, error)
	GetAll(budgetID string) ([]*models.BankAccount, error)
	GetByID(id string) (*models.BankAccount, error)
	Create(budgetID string, name string) (*models.BankAccount, error)
	Delete(id string) error
}

type IBudgets

type IBudgets interface {
	BelongsTo(userAccountID, budgetID string) (bool, error)
	ExistsByID(id string) (bool, error)
	ExistsByUserIDAndName(userAccountID, name string) (bool, error)
	GetAllByUserAccountID(userAccountID string) ([]*models.Budget, error)
	GetByID(id string) (*models.Budget, error)
	GetByUserIDAndName(userAccountID, name string) (*models.Budget, error)
	Create(userAccountId, name string) (*models.Budget, error)
	Delete(id string) error
}

type IUserAccounts

type IUserAccounts interface {
	GetInfo(username string) (*models.UserAccount, error)
	ExistsByUsername(username string) (bool, error)
	Create(username, password string, email *string) (*models.UserAccount, error)
	Delete(username string) error
}

type UserAccounts

type UserAccounts struct {
	Repository repositories.IUserAccounts
}

func (*UserAccounts) Create

func (ua *UserAccounts) Create(username, password string, email *string) (*models.UserAccount, error)

func (*UserAccounts) Delete

func (ua *UserAccounts) Delete(username string) error

func (*UserAccounts) ExistsByUsername

func (ua *UserAccounts) ExistsByUsername(username string) (bool, error)

func (*UserAccounts) GetInfo

func (ua *UserAccounts) GetInfo(username string) (*models.UserAccount, error)

Jump to

Keyboard shortcuts

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