moneyaccount

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2024 License: GPL-3.0 Imports: 9 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 {
	ID            uint
	Name          string
	AccountNumber string
	Description   string
	Balance       float64
	Currency      currency.Currency
	CreatedAt     time.Time
	UpdatedAt     time.Time
}

func (*Account) Ok

func (p *Account) Ok(l ut.Translator) (map[string]string, bool)

type CreateDTO

type CreateDTO struct {
	Name          string  `validate:"required"`
	Balance       float64 `validate:"required,gte=0"`
	AccountNumber string
	CurrencyCode  string `validate:"required,len=3"`
	Description   string
}

func (*CreateDTO) Ok

func (p *CreateDTO) Ok(l ut.Translator) (map[string]string, bool)

func (*CreateDTO) ToEntity

func (p *CreateDTO) ToEntity() (*Account, error)

type CreatedEvent

type CreatedEvent struct {
	Sender  user.User
	Session session.Session
	Data    CreateDTO
	Result  Account
}

func NewCreatedEvent

func NewCreatedEvent(ctx context.Context, data CreateDTO, result Account) (*CreatedEvent, error)

type DeletedEvent

type DeletedEvent struct {
	Sender  user.User
	Session session.Session
	Result  Account
}

func NewDeletedEvent

func NewDeletedEvent(ctx context.Context, result Account) (*DeletedEvent, error)

type Repository

type Repository interface {
	Count(ctx context.Context) (uint, error)
	GetAll(ctx context.Context) ([]*Account, error)
	GetPaginated(ctx context.Context, limit, offset int, sortBy []string) ([]*Account, error)
	GetByID(ctx context.Context, id uint) (*Account, error)
	RecalculateBalance(ctx context.Context, id uint) error
	Create(ctx context.Context, payment *Account) error
	Update(ctx context.Context, payment *Account) error
	Delete(ctx context.Context, id uint) error
}

type UpdateDTO

type UpdateDTO struct {
	Name          string  `validate:"lte=255"`
	Balance       float64 `validate:"gte=0"`
	AccountNumber string
	CurrencyCode  string `validate:"len=3"`
	Description   string
}

func (*UpdateDTO) Ok

func (p *UpdateDTO) Ok(l ut.Translator) (map[string]string, bool)

func (*UpdateDTO) ToEntity

func (p *UpdateDTO) ToEntity(id uint) (*Account, error)

type UpdatedEvent

type UpdatedEvent struct {
	Sender  user.User
	Session session.Session
	Data    UpdateDTO
	Result  Account
}

func NewUpdatedEvent

func NewUpdatedEvent(ctx context.Context, data UpdateDTO, result Account) (*UpdatedEvent, error)

Jump to

Keyboard shortcuts

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