97 lines
3.9 KiB
Go
Raw Normal View History

2025-03-08 00:35:23 +07:00
package models
import (
"time"
)
type OrderDB struct {
2025-06-14 21:17:13 +07:00
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"`
2025-03-08 00:35:23 +07:00
}
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"`
2025-04-10 11:21:08 +07:00
ItemName string `gorm:"column:item_name"`
2025-03-08 00:35:23 +07:00
ItemType string `gorm:"column:item_type"`
Price float64 `gorm:"column:price"`
Quantity int `gorm:"column:quantity"`
2025-06-27 13:01:39 +07:00
Status string `gorm:"column:status;default:ACTIVE"`
2025-03-08 00:35:23 +07:00
CreatedBy int64 `gorm:"column:created_by"`
CreatedAt time.Time `gorm:"column:created_at"`
2025-04-10 11:21:08 +07:00
Product ProductDB `gorm:"foreignKey:ItemID;references:ID"`
2025-05-16 13:18:11 +07:00
Notes string `gorm:"column:notes"`
2025-03-08 00:35:23 +07:00
}
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"`
2025-04-10 11:21:08 +07:00
Tax float64 `gorm:"column:tax"`
2025-03-08 00:35:23 +07:00
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"`
2025-04-05 11:28:06 +08:00
PaymentProvider string `gorm:"column:payment_provider"`
TableNumber string `gorm:"column:table_number"`
OrderType string `gorm:"column:order_type"`
2025-06-14 21:17:13 +07:00
CashierSessionID int64 `gorm:"column:cashier_session_id"`
2025-03-08 00:35:23 +07:00
}
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"`
2025-04-10 11:21:08 +07:00
ItemName string `gorm:"column:item_name"`
2025-03-08 00:35:23 +07:00
Price float64 `gorm:"column:price"`
Quantity int `gorm:"column:quantity"`
CreatedBy int64 `gorm:"column:created_by"`
CreatedAt time.Time `gorm:"column:created_at"`
2025-05-16 13:18:11 +07:00
Notes string `gorm:"column:notes"`
2025-03-08 00:35:23 +07:00
}
func (InquiryItemDB) TableName() string {
return "inquiry_items"
}