2025-06-27 13:01:39 +07:00

97 lines
3.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"`
Tax float64 `gorm:"column:tax"`
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"`
OrderType string `gorm:"column:order_type"`
TableNumber string `gorm:"column:table_number"`
PaymentProvider string `gorm:"column:payment_provider"`
CustomerName string `gorm:"column:customer_name"`
CashierSessionID int64 `gorm:"column:cashier_session_id"`
Description string `gorm:"column:description"`
}
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"`
ItemName string `gorm:"column:item_name"`
ItemType string `gorm:"column:item_type"`
Price float64 `gorm:"column:price"`
Quantity int `gorm:"column:quantity"`
Status string `gorm:"column:status;default:ACTIVE"`
CreatedBy int64 `gorm:"column:created_by"`
CreatedAt time.Time `gorm:"column:created_at"`
Product ProductDB `gorm:"foreignKey:ItemID;references:ID"`
Notes string `gorm:"column:notes"`
}
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"`
Tax float64 `gorm:"column:tax"`
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"`
PaymentProvider string `gorm:"column:payment_provider"`
TableNumber string `gorm:"column:table_number"`
OrderType string `gorm:"column:order_type"`
CashierSessionID int64 `gorm:"column:cashier_session_id"`
}
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"`
ItemName string `gorm:"column:item_name"`
Price float64 `gorm:"column:price"`
Quantity int `gorm:"column:quantity"`
CreatedBy int64 `gorm:"column:created_by"`
CreatedAt time.Time `gorm:"column:created_at"`
Notes string `gorm:"column:notes"`
}
func (InquiryItemDB) TableName() string {
return "inquiry_items"
}