payment

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 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 CreateDTO

type CreateDTO struct {
	Amount           float64   `validate:"required,gt=0"`
	AccountID        uint      `validate:"required"`
	TransactionDate  time.Time `validate:"required"`
	AccountingPeriod time.Time `validate:"required"`
	Comment          string
	UserID           uint `validate:"required"`
	StageID          uint `validate:"required"`
}

func (*CreateDTO) Ok

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

func (*CreateDTO) ToEntity

func (p *CreateDTO) ToEntity() *Payment

type Created

type Created struct {
	Sender  user.User
	Session session.Session
	Data    CreateDTO
	Result  Payment
}

func NewCreatedEvent

func NewCreatedEvent(ctx context.Context, data CreateDTO, result Payment) (*Created, error)

type Deleted

type Deleted struct {
	Sender  user.User
	Session session.Session
	Result  Payment
}

func NewDeletedEvent

func NewDeletedEvent(ctx context.Context, result Payment) (*Deleted, error)

type Payment

type Payment struct {
	ID               uint
	StageID          uint
	Amount           float64
	TransactionID    uint
	Account          moneyAccount.Account
	TransactionDate  time.Time
	AccountingPeriod time.Time
	Comment          string
	User             *user.User
	CreatedAt        time.Time
	UpdatedAt        time.Time
}

func (*Payment) Ok

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

func (*Payment) ToGraph

func (p *Payment) ToGraph() *model.Payment

type Repository

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

type UpdateDTO

type UpdateDTO struct {
	Amount           float64 `validate:"gt=0"`
	AccountID        uint
	TransactionDate  time.Time
	AccountingPeriod time.Time
	Comment          string
	UserID           uint
	StageID          uint
}

func (*UpdateDTO) Ok

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

func (*UpdateDTO) ToEntity

func (p *UpdateDTO) ToEntity(id uint) *Payment

type Updated

type Updated struct {
	Sender  user.User
	Session session.Session
	Data    UpdateDTO
	Result  Payment
}

func NewUpdatedEvent

func NewUpdatedEvent(ctx context.Context, data UpdateDTO, result Payment) (*Updated, error)

Jump to

Keyboard shortcuts

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