service

package
v0.0.0-...-405484a Latest Latest
Warning

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

Go to latest
Published: May 2, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthService

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

func NewAuthService

func NewAuthService(repo repository.Authorization, repoToken repository.Tokens) *AuthService

func (*AuthService) CreateUser

func (s *AuthService) CreateUser(user domain.User) (int64, error)

func (*AuthService) ParseToken

func (s *AuthService) ParseToken(accessToken string) (int64, error)

func (*AuthService) RefreshToken

func (s *AuthService) RefreshToken(refreshToken string) (string, string, error)

func (*AuthService) SignIn

func (s *AuthService) SignIn(username, password string) (string, string, error)

type Authorization

type Authorization interface {
	CreateUser(user domain.User) (int64, error)
	SignIn(username, password string) (string, string, error)
	ParseToken(token string) (int64, error)
	RefreshToken(refreshToken string) (string, string, error)
}

type Service

type Service struct {
	Authorization
	Wallet
	Transaction
}

func NewService

func NewService(repos *repository.Repository) *Service

type Transaction

type Transaction interface {
	CreateTransaction(userId, walletId int64, transaction domain.Transaction) (int64, error)
	GetAllTransactions(userId, walletId int64) ([]domain.Transaction, error)
	GetTransactionById(userId, walletId, transactionId int64) (domain.Transaction, error)
	UpdateTransaction(userId, walletId, transactionId int64, input domain.UpdateTransactionInput) error
	DeleteTransaction(userId, walletId, transactionId int64) error
}

type TransactionService

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

func NewTransactionService

func NewTransactionService(repo repository.Transaction, walletRepo repository.Wallet) *TransactionService

func (*TransactionService) CreateTransaction

func (s *TransactionService) CreateTransaction(userId, walletId int64, transaction domain.Transaction) (int64, error)

func (*TransactionService) DeleteTransaction

func (s *TransactionService) DeleteTransaction(userId, walletId, transactionId int64) error

func (*TransactionService) GetAllTransactions

func (s *TransactionService) GetAllTransactions(userId, walletId int64) ([]domain.Transaction, error)

func (*TransactionService) GetTransactionById

func (s *TransactionService) GetTransactionById(userId, walletId, transactionId int64) (domain.Transaction, error)

func (*TransactionService) UpdateTransaction

func (s *TransactionService) UpdateTransaction(userId, walletId, transactionId int64, input domain.UpdateTransactionInput) error

type Wallet

type Wallet interface {
	CreateWallet(userId int64, wallet domain.Wallet) (int64, error)
	GetAllWallets(userId int64) ([]domain.Wallet, error)
	GetWalletById(userId, walletId int64) (domain.Wallet, error)
	UpdateWallet(userId, walletId int64, input domain.UpdateWalletInput) error
	DeleteWallet(userId, walletId int64) error
}

type WalletService

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

func NewWalletService

func NewWalletService(repo repository.Wallet) *WalletService

func (*WalletService) CreateWallet

func (s *WalletService) CreateWallet(userId int64, wallet domain.Wallet) (int64, error)

func (*WalletService) DeleteWallet

func (s *WalletService) DeleteWallet(userId, walletId int64) error

func (*WalletService) GetAllWallets

func (s *WalletService) GetAllWallets(userId int64) ([]domain.Wallet, error)

func (*WalletService) GetWalletById

func (s *WalletService) GetWalletById(userId, walletId int64) (domain.Wallet, error)

func (*WalletService) UpdateWallet

func (s *WalletService) UpdateWallet(userId, walletId int64, input domain.UpdateWalletInput) error

Jump to

Keyboard shortcuts

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