entity

package
v0.0.0-...-8054c29 Latest Latest
Warning

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

Go to latest
Published: May 21, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Category

type Category struct {
	ID   int    `json:"id" gorm:"primaryKey"`
	Name string `json:"name"`
}

type Client

type Client struct {
	ID    int    `json:"id" gorm:"primaryKey;autoIncrement"`
	Cpf   int    `json:"cpf"`
	Name  string `json:"name"`
	Email string `json:"email"`
}

type ExternalPayment

type ExternalPayment struct {
	ID      *uuid.UUID       `json:"id"`
	OrderID int              `json:"-"`
	Order   *Order           `json:"order"`
	Type    enum.PaymentType `json:"type"`
	Amount  float32          `json:"amount"`
}

type Order

type Order struct {
	ID          int              `json:"id" gorm:"primaryKey;autoIncrement"`
	ClientId    *int             `json:"client_id"`
	StatusOrder enum.StatusOrder `json:"status_order"`
	Amount      float32          `json:"amount"`
	CreatedAt   time.Time        `json:"created_at,omitempty"`
	Products    []*Product       `json:"products" gorm:"many2many:orders_products"`
}

func (*Order) SetAmount

func (o *Order) SetAmount(amount float32)

type Payment

type Payment struct {
	ID        int                `json:"id" gorm:"primaryKey;autoIncrement"`
	OrderID   int                `json:"-"`
	Order     *Order             `json:"order" gorm:"foreignKey:OrderID;references:ID"`
	Type      enum.PaymentType   `json:"type"`
	Status    enum.PaymentStatus `json:"status"`
	Amount    float32            `json:"amount"`
	CreatedAt *time.Time         `json:"created_at,omitempty"`
	UpdatedAt *time.Time         `json:"updated_at,omitempty"`
	DeletedAt *time.Time         `json:"deleted_at,omitempty"`
}

type Product

type Product struct {
	ID          int     `json:"id" gorm:"primaryKey;autoIncrement"`
	NameProduct string  `json:"name_product"`
	Description string  `json:"description"`
	Price       float32 `json:"price"`
	CategoryId  int     `json:"category_id"`
	Active      bool    `json:"active"`
}

Jump to

Keyboard shortcuts

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