order

package
v0.0.0-...-eda81a1 Latest Latest
Warning

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

Go to latest
Published: May 22, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ControllerOrder

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

func New

func New(repository Storage, changers map[model.TypePacking]order_changers.ChangerOrder, tm Manager) *ControllerOrder

func (*ControllerOrder) AcceptOrder

func (c *ControllerOrder) AcceptOrder(ctx context.Context, data model.OrderInitData) (string, error)

func (*ControllerOrder) GetReturnedOrders

func (c *ControllerOrder) GetReturnedOrders(ctx context.Context, values controller.ValuesView) ([]model.Order, error)

func (*ControllerOrder) IssuingToCustomer

func (c *ControllerOrder) IssuingToCustomer(ctx context.Context, orderIDs []string) error

IssuingToCustomer TODO: change transaction params!

func (*ControllerOrder) ReturnOrder

func (c *ControllerOrder) ReturnOrder(ctx context.Context, orderID string, customerID string) error

ReturnOrder TODO: change transaction options

func (*ControllerOrder) ReturnOrderToCourier

func (c *ControllerOrder) ReturnOrderToCourier(ctx context.Context, orderID string) error

func (*ControllerOrder) SearchOrders

func (c *ControllerOrder) SearchOrders(ctx context.Context, customerID string, values controller.ValuesView) ([]model.Order, error)

type Manager

type Manager interface {
	// Do processes a transaction inside a closure.
	Do(context.Context, func(ctx context.Context) error) error
	// DoWithSettings processes a transaction inside a closure with custom trm.Settings.
	DoWithSettings(context.Context, trm.Settings, func(ctx context.Context) error) error
}

type Storage

type Storage interface {
	Create(ctx context.Context, dto repository.OrderDTO) (pgtype.UUID, error)

	GetByID(ctx context.Context, id pgtype.UUID) (repository.OrderDTO, error)
	GetByCustomerID(ctx context.Context, id pgtype.UUID) ([]repository.OrderDTO, error)

	List(ctx context.Context) ([]repository.OrderDTO, error)
	ListReadyToIssued(ctx context.Context) ([]repository.OrderDTO, error)

	UpdateToReceived(ctx context.Context, orderID pgtype.UUID) error
	UpdateToReturned(ctx context.Context, orderID pgtype.UUID) error

	Delete(ctx context.Context, orderID pgtype.UUID) error
}

Jump to

Keyboard shortcuts

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