expense

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2024 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateDTO

type CreateDTO struct {
	Amount           float64
	AccountID        uint
	CategoryID       uint
	Comment          string
	AccountingPeriod time.Time
	Date             time.Time
}

func (*CreateDTO) Ok

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

func (*CreateDTO) ToEntity

func (d *CreateDTO) ToEntity() (*Expense, error)

type CreatedEvent

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

func NewCreatedEvent

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

type DeletedEvent

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

func NewDeletedEvent

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

type Expense

type Expense struct {
	ID               uint
	Amount           float64
	Account          moneyAccount.Account
	Category         category.ExpenseCategory
	Comment          string
	TransactionID    uint
	AccountingPeriod time.Time
	Date             time.Time
	CreatedAt        time.Time
	UpdatedAt        time.Time
}

type Repository

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

type UpdateDTO

type UpdateDTO struct {
	Amount           float64
	AccountID        uint
	CategoryID       uint
	Comment          string
	AccountingPeriod time.Time
	Date             time.Time
}

func (*UpdateDTO) Ok

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

func (*UpdateDTO) ToEntity

func (d *UpdateDTO) ToEntity(id uint) (*Expense, error)

type UpdatedEvent

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

func NewUpdatedEvent

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

Jump to

Keyboard shortcuts

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