model

package
v0.0.0-...-5e1236a Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Order

type Order struct {
	ID        uuid.UUID `json:"order_id"`
	UserID    uuid.UUID `json:"user_id"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`

	Orderlines []*Orderline `json:"orderlines"`
}

Represents how the order structure is stored in the database

func (*Order) ToProto

func (order *Order) ToProto() *pbOrder.OrderResponse

type Orderline

type Orderline struct {
	OrderID   uuid.UUID       `json:"order_id"`
	ProductID uuid.UUID       `json:"product_id"`
	Name      string          `json:"name" validate:"max=128"`
	Price     int64           `json:"price" validate:"min=0,max=1000000000"`
	Quantity  int64           `json:"quantity" validate:"min=0,max=10000000"`
	Status    OrderlineStatus `json:"status" validate:"min=0,max=3"`
	CreatedAt time.Time       `json:"created_at"`
	UpdatedAt time.Time       `json:"updated_at"`
}

Represents one line with a product in a order in the database

func (*Orderline) ToProto

func (orderline *Orderline) ToProto() *pbOrder.OrderlineResponse

func (*Orderline) Validate

func (orderline *Orderline) Validate() error

type OrderlineStatus

type OrderlineStatus int32
const (
	Canceled OrderlineStatus = iota
	PendingPayment
	Delivery
	Recieved
)

Jump to

Keyboard shortcuts

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