service

package
v0.0.0-...-f0852b9 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2024 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAlreadyExists = errors.New("object already exists")
	ErrInvalidData   = errors.New("provided data is invalid")
	ErrUnexpected    = errors.New("unexpected error occurred")
)

Functions

This section is empty.

Types

type Order

type Order struct {
	ID         uuid.UUID
	Restaurant uuid.UUID
	Products   []Product
	Customer   struct {
		ID      uuid.UUID
		Address string
	}
	CreatedAt time.Time

	Acceptance *struct {
		Manager    uuid.UUID
		AcceptedAt time.Time
	}

	Courier *struct {
		ID      uuid.UUID
		TakenAt time.Time
	}

	Payment *struct {
		Transaction string
		PayedAt     time.Time
	}

	Cancellation *struct {
		Canceller   uuid.UUID
		CancelledAt time.Time
	}

	CookingStartedAt  *time.Time
	DeliveryStartedAt *time.Time
	DeliveryCompleted *time.Time
}

type OrderHistory

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

func NewOrderHistory

func NewOrderHistory(logger *slog.Logger, storage Storage) *OrderHistory

func (*OrderHistory) AddOrder

func (svc *OrderHistory) AddOrder(ctx context.Context, order Order) error

type Product

type Product struct {
	ID          uuid.UUID
	Original    uuid.UUID
	Restaurant  uuid.UUID
	Name        string
	Picture     string
	Price       float64
	Description string
}

type Storage

type Storage interface {
	Add(ctx context.Context, order Order) error
}

Jump to

Keyboard shortcuts

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