models

package
v0.0.0-...-af0b203 Latest Latest
Warning

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

Go to latest
Published: May 27, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BadGatewayResponse

func BadGatewayResponse(ctx *gin.Context, errors []string)

func BadRequestResponse

func BadRequestResponse(ctx *gin.Context, errors []string)

func CreatedResponse

func CreatedResponse(ctx *gin.Context, data interface{})

func OkResponse

func OkResponse(ctx *gin.Context, data interface{})

Types

type Customer

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

type CustomerAddress

type CustomerAddress struct {
	ID         int       `json:"id" gorm:"primaryKey"`
	CustomerID int       `json:"customer_id" gorm:"not null;"`
	Address    string    `json:"address" gorm:"not null"`
	Customer   *Customer `json:"customer,omitempty"`
}

type Order

type Order struct {
	ID         int              `json:"id" gorm:"primaryKey"`
	CustomerID int              `json:"customer_id" gorm:"not null"`
	Customer   *Customer        `json:"customer,omitempty"`
	AddressID  int              `json:"address_id" gorm:"not null"`
	Address    *CustomerAddress `json:"address,omitempty"`
}

type OrderDetail

type OrderDetail struct {
	ID              int            `json:"id" gorm:"primaryKey"`
	OrderID         int            `json:"order_id" gorm:"not null"`
	Order           *Order         `json:"order,omitempty"`
	ProductID       int            `json:"product_id" gorm:"not null"`
	Product         *Product       `json:"product,omitempty"`
	Quantity        int            `json:"quantity" gorm:"not null"`
	TotalPrice      float32        `json:"total_price" gorm:"not null"`
	PaymentMethodID int            `json:"payment_method_id" gorm:"not null"`
	PaymentMethod   *PaymentMethod `json:"payment_method,omitempty"`
	IsPaid          bool           `json:"is_paid" gorm:"not null;default:false"`
}

type OrderPayload

type OrderPayload struct {
	CustomerID      int     `json:"customer_id"`
	AddressID       int     `json:"address_id"`
	ProductID       int     `json:"product_id"`
	Quantity        int     `json:"quantity"`
	TotalPrice      float32 `json:"total_price"`
	PaymentMethodID int     `json:"payment_method_id"`
	IsPaid          bool    `json:"is_paid"`
}

type PaymentMethod

type PaymentMethod struct {
	ID       int    `json:"id" gorm:"primaryKey"`
	Name     string `json:"name" gorm:"not null"`
	IsActive bool   `json:"is_active" gorm:"not null;default:false"`
}

type Product

type Product struct {
	ID    int     `json:"id" gorm:"primaryKey"`
	Name  string  `json:"name" gorm:"not null"`
	Price float32 `json:"price" gorm:"not null"`
}

type Response

type Response struct {
	Code   int         `json:"code"`
	Status string      `json:"status"`
	Errors []string    `json:"errors"`
	Data   interface{} `json:"data"`
}

Jump to

Keyboard shortcuts

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