81 lines
2.9 KiB
Go
81 lines
2.9 KiB
Go
package models
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
type OrderDB struct {
|
|
ID int64 `gorm:"primaryKey;column:id"`
|
|
PartnerID int64 `gorm:"column:partner_id"`
|
|
CustomerID *int64 `gorm:"column:customer_id"`
|
|
InquiryID *string `gorm:"column:inquiry_id"`
|
|
Status string `gorm:"column:status"`
|
|
Amount float64 `gorm:"column:amount"`
|
|
Fee float64 `gorm:"column:fee"`
|
|
Total float64 `gorm:"column:total"`
|
|
PaymentType string `gorm:"column:payment_type"`
|
|
Source string `gorm:"column:source"`
|
|
CreatedBy int64 `gorm:"column:created_by"`
|
|
CreatedAt time.Time `gorm:"column:created_at"`
|
|
UpdatedAt time.Time `gorm:"column:updated_at"`
|
|
OrderItems []OrderItemDB `gorm:"foreignKey:OrderID"`
|
|
}
|
|
|
|
func (OrderDB) TableName() string {
|
|
return "orders"
|
|
}
|
|
|
|
type OrderItemDB struct {
|
|
ID int64 `gorm:"primaryKey;column:order_item_id"`
|
|
OrderID int64 `gorm:"column:order_id"`
|
|
ItemID int64 `gorm:"column:item_id"`
|
|
ItemType string `gorm:"column:item_type"`
|
|
Price float64 `gorm:"column:price"`
|
|
Quantity int `gorm:"column:quantity"`
|
|
CreatedBy int64 `gorm:"column:created_by"`
|
|
CreatedAt time.Time `gorm:"column:created_at"`
|
|
}
|
|
|
|
func (OrderItemDB) TableName() string {
|
|
return "order_items"
|
|
}
|
|
|
|
type OrderInquiryDB struct {
|
|
ID string `gorm:"primaryKey;column:id"`
|
|
PartnerID int64 `gorm:"column:partner_id"`
|
|
CustomerID *int64 `gorm:"column:customer_id"`
|
|
CustomerName string `gorm:"column:customer_name"`
|
|
CustomerEmail string `gorm:"column:customer_email"`
|
|
CustomerPhoneNumber string `gorm:"column:customer_phone_number"`
|
|
Status string `gorm:"column:status"`
|
|
Amount float64 `gorm:"column:amount"`
|
|
Fee float64 `gorm:"column:fee"`
|
|
Total float64 `gorm:"column:total"`
|
|
PaymentType string `gorm:"column:payment_type"`
|
|
Source string `gorm:"column:source"`
|
|
CreatedBy int64 `gorm:"column:created_by"`
|
|
CreatedAt time.Time `gorm:"column:created_at"`
|
|
UpdatedAt time.Time `gorm:"column:updated_at"`
|
|
ExpiresAt time.Time `gorm:"column:expires_at"`
|
|
InquiryItems []InquiryItemDB `gorm:"foreignKey:InquiryID"`
|
|
}
|
|
|
|
func (OrderInquiryDB) TableName() string {
|
|
return "order_inquiries"
|
|
}
|
|
|
|
type InquiryItemDB struct {
|
|
ID int64 `gorm:"primaryKey;column:id"`
|
|
InquiryID string `gorm:"column:inquiry_id"`
|
|
ItemID int64 `gorm:"column:item_id"`
|
|
ItemType string `gorm:"column:item_type"`
|
|
Price float64 `gorm:"column:price"`
|
|
Quantity int `gorm:"column:quantity"`
|
|
CreatedBy int64 `gorm:"column:created_by"`
|
|
CreatedAt time.Time `gorm:"column:created_at"`
|
|
}
|
|
|
|
func (InquiryItemDB) TableName() string {
|
|
return "inquiry_items"
|
|
}
|