entities

package
v0.0.0-...-469fbc3 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RECEIVED_STATUS       = "RECEBIDO"
	IN_PREPARATION_STATUS = "EM_PREPARACAO"
	DONE_STATUS           = "PRONTO"
	FINISHED_STATUS       = "FINALIZADO"
)
View Source
const (
	PAYMENT_STATUS_WAITING  = 1
	PAYMENT_STATUS_RECUSED  = 2
	PAYMENT_STATUS_APPROVED = 3
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Customer

type Customer struct {
	ID    uint32 `gorm:"primary_key;auto_increment"`
	Name  string `gorm:"size:255;not null;"`
	Email string `gorm:"size:255;not null;"`
	CPF   string `gorm:"size:11;not null;"`
	gorm.Model

} //@name domain.Customer

func NewCustomer

func NewCustomer(customer dto.CustomerDto) (*Customer, error)

func (Customer) Validate

func (c Customer) Validate() error

type Item

type Item struct {
	ID       uint32  `gorm:"primary_key;auto_increment"`
	Name     string  `gorm:"size:255;not null;"`
	Category string  `gorm:"size:30;not null;"`
	Price    float32 `gorm:"not null;"`
	ImageUrl string  `gorm:"size:255;not null;"`
	gorm.Model

} //@name domain.Item

func NewItem

func NewItem(item dto.ItemDto) (*Item, error)

func (Item) Validate

func (item Item) Validate() error

func (Item) ValidateCategory

func (item Item) ValidateCategory() error

type Order

type Order struct {
	ID         uint32      `gorm:"primarykey;autoIncrement" json:"id"`
	Items      []OrderItem `gorm:"foreignKey:OrderID;references:ID;constraint:OnDelete:CASCADE" json:"items"`
	CustomerID uint32      `json:"customer_id"`
	Status     string      `json:"status"`
	CreatedAt  time.Time   `json:"created_at"`
	UpdatedAt  time.Time   `json:"updated_at"`

} //@name domain.Order

func NewOrder

func NewOrder(orderDto dto.OrderDto) (*Order, error)

func (Order) Validate

func (order Order) Validate() error

type OrderItem

type OrderItem struct {
	ID       uint32 `gorm:"primarykey;autoIncrement" json:"-"`
	OrderID  uint32 `json:"-"`
	ItemID   uint32 `json:"id"`
	Quantity uint32 `json:"quantity"`
	Item     Item   `gorm:"references:ID" json:"-"`

} //@name domain.OrderItem

func OrderItemToDomain

func OrderItemToDomain(orderDto dto.OrderDto) (list []OrderItem)

type OrderPayment

type OrderPayment struct {
	ID              uint32 `gorm:"primary_key;auto_increment"`
	OrderID         uint32
	PaymentStatusID uint32
	PaymentStatus   PaymentStatus
	gorm.Model
}

func NewOrderPayment

func NewOrderPayment(orderID uint32, paymentStatusID uint32) (*OrderPayment, error)

func (*OrderPayment) SetPaymentStatus

func (orderPayment *OrderPayment) SetPaymentStatus(statusID uint32) error

func (OrderPayment) Validate

func (orderPayment OrderPayment) Validate() error

type PaymentStatus

type PaymentStatus struct {
	ID   uint32 `gorm:"primary_key;auto_increment"`
	Name string `gorm:"size:255;not null"`
	gorm.Model
}

Jump to

Keyboard shortcuts

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