order struct
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
package model
|
||||
|
||||
type CustomerOrder struct {
|
||||
ID uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
|
||||
UserID uint `gorm:"column:user_id;not null;index" json:"-"`
|
||||
CountryID uint `gorm:"column:country_id;not null" json:"country_id"`
|
||||
AddressJSON *string `gorm:"column:address_json" json:"address_json,omitempty"`
|
||||
Status *string `gorm:"column:status;size:50" json:"status,omitempty"`
|
||||
Products []OrderProduct `gorm:"foreignKey:OrderID;references:ID" json:"products,omitempty"`
|
||||
}
|
||||
|
||||
func (CustomerOrder) TableName() string {
|
||||
return "b2b_customer_orders"
|
||||
}
|
||||
|
||||
type OrderProduct struct {
|
||||
ID uint `gorm:"column:id;primaryKey;autoIncrement" json:"-"`
|
||||
OrderID uint `gorm:"column:order_id;not null;index" json:"-"`
|
||||
ProductID uint `gorm:"column:product_id;not null" json:"product_id"`
|
||||
ProductAttributeID *uint `gorm:"column:product_attribute_id" json:"product_attribute_id,omitempty"`
|
||||
Amount uint `gorm:"column:amount;not null" json:"amount"`
|
||||
}
|
||||
|
||||
func (OrderProduct) TableName() string {
|
||||
return "b2b_orders_products"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user