domain

package
v0.0.0-...-de98b0a Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

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 NewAccount

func NewAccount(customerId, accountType string, amount float64) Account

func (Account) CanWithdraw

func (a Account) CanWithdraw(amount float64) bool

func (Account) ToNewAccountResponseDto

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

type AccountRepository

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

type AccountRepositoryDb

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

func NewAccountRepositoryDb

func NewAccountRepositoryDb(dbClient *sqlx.DB) AccountRepositoryDb

func (AccountRepositoryDb) FindBy

func (d AccountRepositoryDb) FindBy(id string) (*Account, *errs.AppError)

func (AccountRepositoryDb) Save

func (AccountRepositoryDb) SaveTransaction

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

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) ToDto

func (c Customer) ToDto() dto.CustomerResponse

type CustomerRepository

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

type CustomerRepositoryDb

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

func NewCustomerRepositoryDb

func NewCustomerRepositoryDb(dbClient *sqlx.DB) CustomerRepositoryDb

func (CustomerRepositoryDb) ById

func (CustomerRepositoryDb) FindAll

func (d CustomerRepositoryDb) FindAll(status 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 {
	Id        string  `db:"transaction_id"`
	AccountId string  `db:"account_id"`
	Amount    float64 `db:"amount"`
	Type      string  `db:"transaction_type"`
	Date      string  `db:"transaction_date"`
}

func (Transaction) IsWithdrawal

func (t Transaction) IsWithdrawal() bool

func (Transaction) ToNewTransactionResponseDto

func (t Transaction) ToNewTransactionResponseDto() dto.TransactionResponse

type TransactionRepository

type TransactionRepository interface {
	Save(Transaction) (*Transaction, *errs.AppError)
}

Jump to

Keyboard shortcuts

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