order struct

This commit is contained in:
Daniel Goc
2026-04-10 11:06:43 +02:00
parent dfdf8b4db9
commit 4f4b32b131
2 changed files with 31 additions and 2 deletions

View File

@@ -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"
}