model

package
v0.0.0-...-f60e707 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GetOrderInfoRequest

type GetOrderInfoRequest struct {
	OrderID string
	UserID  string
}

type LoginRequest

type LoginRequest struct {
	Username string `json:"username"`
	Password string `json:"password"`
}
type MenuItem struct {
	OrderCode string            `gorm:"primaryKey" json:"order_code"`
	Name      string            `json:"name"`
	Price     int64             `json:"price"`
	Type      constant.MenuType `json:"type"`
}

type Order

type Order struct {
	// just note, gorm uses ID field as primary key by default
	ID            string               `gorm:"primaryKey" json:"id"`
	UserID        string               `gorm:"index" json:"user_id"`
	Status        constant.OrderStatus `json:"status"`
	ProductOrders []ProductOrder       `json:"product_orders"`
	ReferenceID   string               `gorm:"unique" json:"reference_id"`
}

Creating a one to many DB approach

type OrderMenuProductRequest

type OrderMenuProductRequest struct {
	OrderCode string `json:"order_code"`
	Quantity  int    `json:"quantity"`
}

type OrderMenuRequest

type OrderMenuRequest struct {
	UserID        string                    `json:"-"`
	OrderProducts []OrderMenuProductRequest `json:"order_products"`
	ReferenceID   string                    `json:"reference_id"`
}

type ProductOrder

type ProductOrder struct {
	ID         string
	OrderID    string
	OrderCode  string
	Quantity   int
	TotalPrice int64
	Status     constant.ProductOrderStatus
}

type RegisterRequest

type RegisterRequest struct {
	Password string `json:"password"`
	Username string `json:"username"`
}

type User

type User struct {
	ID       string `json:"id"`
	Username string `gorm:"unique" json:"username"`
	Hash     string `json:"-"`
}

type UserSession

type UserSession struct {
	JWTToken string `json:"jwt_token"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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