This commit is contained in:
aditya.siregar
2025-04-10 11:21:08 +07:00
parent c642c5c61b
commit 09c9a4d59d
30 changed files with 1797 additions and 758 deletions
+22 -15
View File
@@ -5,20 +5,24 @@ import (
)
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"`
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"`
}
func (OrderDB) TableName() string {
@@ -29,11 +33,13 @@ 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"`
CreatedBy int64 `gorm:"column:created_by"`
CreatedAt time.Time `gorm:"column:created_at"`
Product ProductDB `gorm:"foreignKey:ItemID;references:ID"`
}
func (OrderItemDB) TableName() string {
@@ -49,7 +55,7 @@ type OrderInquiryDB struct {
CustomerPhoneNumber string `gorm:"column:customer_phone_number"`
Status string `gorm:"column:status"`
Amount float64 `gorm:"column:amount"`
Fee float64 `gorm:"column:fee"`
Tax float64 `gorm:"column:tax"`
Total float64 `gorm:"column:total"`
PaymentType string `gorm:"column:payment_type"`
Source string `gorm:"column:source"`
@@ -72,6 +78,7 @@ type InquiryItemDB struct {
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"`
@@ -0,0 +1,53 @@
package models
import (
"time"
)
type PartnerSettingsDB struct {
PartnerID int64 `gorm:"primaryKey;column:partner_id"`
TaxEnabled bool `gorm:"column:tax_enabled;default:false"`
TaxPercentage float64 `gorm:"column:tax_percentage;default:10.00"`
InvoicePrefix string `gorm:"column:invoice_prefix;default:INV"`
BusinessHours string `gorm:"column:business_hours;type:json"` // JSON string
LogoURL string `gorm:"column:logo_url"`
ThemeColor string `gorm:"column:theme_color;default:#000000"`
ReceiptFooterText string `gorm:"column:receipt_footer_text;type:text"`
ReceiptHeaderText string `gorm:"column:receipt_header_text;type:text"`
CreatedAt time.Time `gorm:"column:created_at;default:CURRENT_TIMESTAMP"`
UpdatedAt time.Time `gorm:"column:updated_at;default:CURRENT_TIMESTAMP"`
}
func (PartnerSettingsDB) TableName() string {
return "partner_settings"
}
type PartnerPaymentMethodDB struct {
ID int64 `gorm:"primaryKey;column:id;autoIncrement"`
PartnerID int64 `gorm:"column:partner_id;index:idx_partner_payment"`
PaymentMethod string `gorm:"column:payment_method;index:idx_partner_payment"`
IsEnabled bool `gorm:"column:is_enabled;default:true"`
DisplayName string `gorm:"column:display_name"`
DisplayOrder int `gorm:"column:display_order;default:0"`
AdditionalInfo string `gorm:"column:additional_info;type:json"` // JSON string
CreatedAt time.Time `gorm:"column:created_at;default:CURRENT_TIMESTAMP"`
UpdatedAt time.Time `gorm:"column:updated_at;default:CURRENT_TIMESTAMP"`
}
func (PartnerPaymentMethodDB) TableName() string {
return "partner_payment_methods"
}
type PartnerFeatureFlagDB struct {
ID int64 `gorm:"primaryKey;column:id;autoIncrement"`
PartnerID int64 `gorm:"column:partner_id;index:idx_partner_feature"`
FeatureKey string `gorm:"column:feature_key;index:idx_partner_feature"`
IsEnabled bool `gorm:"column:is_enabled;default:true"`
Config string `gorm:"column:config;type:json"` // JSON string
CreatedAt time.Time `gorm:"column:created_at;default:CURRENT_TIMESTAMP"`
UpdatedAt time.Time `gorm:"column:updated_at;default:CURRENT_TIMESTAMP"`
}
func (PartnerFeatureFlagDB) TableName() string {
return "partner_feature_flags"
}