domain

package
v0.0.0-...-9035b86 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const WITHDRAWAL = "withdrawal"

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	AccountId   string  `db:"account_id"`
	CustomerId  string  `db:"customer_id"`
	OpeningDate string  `db:"opening_date"`
	AccountType string  `db:"account_type"`
	Amount      float64 `db:"amount"`
	Status      string  `db:"status"`
}

func NewAccountFromRequest

func NewAccountFromRequest(req dto.AccountRequest) Account

func (Account) CanWithdraw

func (a Account) CanWithdraw(amount float64) bool

func (Account) NewAccountResponse

func (a Account) NewAccountResponse() *dto.AccountResponse

type AccountRepository

type AccountRepository interface {
	Save(Account) (*Account, *errs.AppError)
	SaveTransaction(transaction Transaction) (*Transaction, *errs.AppError)
	FindBy(accountId string) (*Account, *errs.AppError)
}

type AccountRepositoryDB

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

func NewAccountRepositoryDb

func NewAccountRepositoryDb(client *sqlx.DB) AccountRepositoryDB

func (AccountRepositoryDB) FindBy

func (d AccountRepositoryDB) FindBy(accountId string) (*Account, *errs.AppError)

func (AccountRepositoryDB) Save

func (AccountRepositoryDB) SaveTransaction

func (d AccountRepositoryDB) SaveTransaction(t Transaction) (*Transaction, *errs.AppError)

*

  • transaction = make an entry in the transaction table + update the balance in the accounts table

type AuthRepository

type AuthRepository interface {
	IsAuthorized(token string, routeName string, vars map[string]string) bool
}

type Customer

type Customer struct {
	Id          string `db:"customer_id"`
	Name        string
	City        string
	Zipcode     string
	DateofBirth string `db:"date_of_birth"`
	Status      string
}

func (Customer) StatusAsText

func (c Customer) StatusAsText() string

func (Customer) ToResponse

func (c Customer) ToResponse() dto.CustomerResponse

type CustomerRepository

type CustomerRepository interface {
	FindAll(status string) ([]Customer, *errs.AppError)
	FindById(string) (*Customer, *errs.AppError)
}

type CustomerRepositoryDB

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

func NewCustomerRepositoryDb

func NewCustomerRepositoryDb(client *sqlx.DB) CustomerRepositoryDB

func (CustomerRepositoryDB) FindAll

func (d CustomerRepositoryDB) FindAll(status string) ([]Customer, *errs.AppError)

func (CustomerRepositoryDB) FindById

func (d CustomerRepositoryDB) FindById(id string) (*Customer, *errs.AppError)

type CustomerRepositoryStub

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

func NewCustomerRepositoryStub

func NewCustomerRepositoryStub() CustomerRepositoryStub

func (CustomerRepositoryStub) FindAll

func (s CustomerRepositoryStub) FindAll() ([]Customer, *errs.AppError)

type RemoteAuthRepository

type RemoteAuthRepository struct {
}

func NewAuthRepository

func NewAuthRepository() RemoteAuthRepository

func (RemoteAuthRepository) IsAuthorized

func (r RemoteAuthRepository) IsAuthorized(token string, routeName string, vars map[string]string) bool

type Transaction

type Transaction struct {
	TransactionId   string  `db:"transaction_id"`
	AccountId       string  `db:"account_id"`
	Amount          float64 `db:"amount"`
	TransactionType string  `db:"transaction_type"`
	TransactionDate string  `db:"transaction_date"`
}

func (Transaction) IsWithdrawal

func (t Transaction) IsWithdrawal() bool

func (Transaction) ToDto

Jump to

Keyboard shortcuts

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