update
This commit is contained in:
@@ -10,7 +10,7 @@ type Order struct {
|
||||
Status string `gorm:"type:varchar;column:status"`
|
||||
Amount float64 `gorm:"type:numeric;not null;column:amount"`
|
||||
Total float64 `gorm:"type:numeric;not null;column:total"`
|
||||
Fee float64 `gorm:"type:numeric;not null;column:fee"`
|
||||
Tax float64 `gorm:"type:numeric;not null;column:tax"`
|
||||
CustomerID *int64
|
||||
CustomerName string
|
||||
InquiryID *string
|
||||
@@ -27,7 +27,7 @@ type Order struct {
|
||||
Source string `gorm:"type:varchar;column:source"`
|
||||
OrderType string `gorm:"type:varchar;column:order_type"`
|
||||
TableNumber string
|
||||
InProgressOrderID string
|
||||
InProgressOrderID int64
|
||||
}
|
||||
|
||||
type OrderDB struct {
|
||||
@@ -86,6 +86,7 @@ type OrderItem struct {
|
||||
CreatedBy int64 `gorm:"type:int;column:created_by"`
|
||||
UpdatedBy int64 `gorm:"type:int;column:updated_by"`
|
||||
Product *Product `gorm:"foreignKey:ItemID;references:ID"`
|
||||
ItemName string `gorm:"type:varchar;column:item_name"`
|
||||
}
|
||||
|
||||
func (OrderItem) TableName() string {
|
||||
@@ -105,6 +106,7 @@ type OrderRequest struct {
|
||||
TableNumber string
|
||||
PaymentProvider string
|
||||
OrderType string
|
||||
ID int64
|
||||
}
|
||||
|
||||
type OrderItemRequest struct {
|
||||
|
||||
@@ -14,7 +14,7 @@ type OrderInquiry struct {
|
||||
CustomerEmail string `json:"customer_email"`
|
||||
Status string `json:"status"`
|
||||
Amount float64 `json:"amount"`
|
||||
Fee float64 `json:"fee"`
|
||||
Tax float64 `json:"tax"`
|
||||
Total float64 `json:"total"`
|
||||
PaymentType string `json:"payment_type"`
|
||||
Source string `json:"source"`
|
||||
@@ -30,7 +30,7 @@ type OrderInquiry struct {
|
||||
|
||||
type OrderCalculation struct {
|
||||
Subtotal float64 `json:"subtotal"`
|
||||
Fee float64 `json:"fee"`
|
||||
Tax float64 `json:"tax"`
|
||||
Total float64 `json:"total"`
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ func NewOrderInquiry(
|
||||
partnerID int64,
|
||||
customerID int64,
|
||||
amount float64,
|
||||
fee float64,
|
||||
tax float64,
|
||||
total float64,
|
||||
paymentType string,
|
||||
source string,
|
||||
@@ -60,7 +60,7 @@ func NewOrderInquiry(
|
||||
PartnerID: partnerID,
|
||||
Status: "PENDING",
|
||||
Amount: amount,
|
||||
Fee: fee,
|
||||
Tax: tax,
|
||||
Total: total,
|
||||
PaymentType: paymentType,
|
||||
CustomerID: customerID,
|
||||
@@ -83,6 +83,7 @@ func (oi *OrderInquiry) AddOrderItem(item OrderItemRequest, product *Product) {
|
||||
ItemID: item.ProductID,
|
||||
ItemType: product.Type,
|
||||
Price: product.Price,
|
||||
ItemName: product.Name,
|
||||
Quantity: item.Quantity,
|
||||
CreatedBy: oi.CreatedBy,
|
||||
Product: product,
|
||||
@@ -98,7 +99,7 @@ func (i *OrderInquiry) ToOrder(paymentMethod, paymentProvider string) *Order {
|
||||
InquiryID: &i.ID,
|
||||
Status: constants.StatusPaid,
|
||||
Amount: i.Amount,
|
||||
Fee: i.Fee,
|
||||
Tax: i.Tax,
|
||||
Total: i.Total,
|
||||
PaymentType: paymentMethod,
|
||||
PaymentProvider: paymentProvider,
|
||||
@@ -107,6 +108,8 @@ func (i *OrderInquiry) ToOrder(paymentMethod, paymentProvider string) *Order {
|
||||
CreatedAt: now,
|
||||
OrderItems: make([]OrderItem, len(i.OrderItems)),
|
||||
OrderType: i.OrderType,
|
||||
CustomerName: i.CustomerName,
|
||||
TableNumber: i.TableNumber,
|
||||
}
|
||||
|
||||
for idx, item := range i.OrderItems {
|
||||
@@ -114,6 +117,7 @@ func (i *OrderInquiry) ToOrder(paymentMethod, paymentProvider string) *Order {
|
||||
ItemID: item.ItemID,
|
||||
ItemType: item.ItemType,
|
||||
Price: item.Price,
|
||||
ItemName: item.ItemName,
|
||||
Quantity: item.Quantity,
|
||||
CreatedBy: i.CreatedBy,
|
||||
CreatedAt: now,
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
package entity
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type PartnerSettings struct {
|
||||
PartnerID int64 `json:"partner_id"`
|
||||
TaxEnabled bool `json:"tax_enabled"`
|
||||
TaxPercentage float64 `json:"tax_percentage"`
|
||||
InvoicePrefix string `json:"invoice_prefix"`
|
||||
BusinessHours string `json:"business_hours"`
|
||||
LogoURL string `json:"logo_url"`
|
||||
ThemeColor string `json:"theme_color"`
|
||||
ReceiptFooterText string `json:"receipt_footer_text"`
|
||||
ReceiptHeaderText string `json:"receipt_header_text"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
|
||||
type PartnerPaymentMethod struct {
|
||||
ID int64 `json:"id"`
|
||||
PartnerID int64 `json:"partner_id"`
|
||||
PaymentMethod string `json:"payment_method"`
|
||||
IsEnabled bool `json:"is_enabled"`
|
||||
DisplayName string `json:"display_name"`
|
||||
DisplayOrder int `json:"display_order"`
|
||||
AdditionalInfo string `json:"additional_info"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
|
||||
type PartnerFeatureFlag struct {
|
||||
ID int64 `json:"id"`
|
||||
PartnerID int64 `json:"partner_id"`
|
||||
FeatureKey string `json:"feature_key"`
|
||||
IsEnabled bool `json:"is_enabled"`
|
||||
Config string `json:"config"` // JSON string
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
|
||||
type BusinessHoursSetting struct {
|
||||
Monday DayHours `json:"monday"`
|
||||
Tuesday DayHours `json:"tuesday"`
|
||||
Wednesday DayHours `json:"wednesday"`
|
||||
Thursday DayHours `json:"thursday"`
|
||||
Friday DayHours `json:"friday"`
|
||||
Saturday DayHours `json:"saturday"`
|
||||
Sunday DayHours `json:"sunday"`
|
||||
}
|
||||
|
||||
type DayHours struct {
|
||||
Open string `json:"open"` // Format: "HH:MM"
|
||||
Close string `json:"close"` // Format: "HH:MM"
|
||||
}
|
||||
@@ -128,3 +128,39 @@ type ProductDetails struct {
|
||||
Products map[int64]*Product // Map for quick lookups by ID
|
||||
PartnerID int64 // Common site ID for all products
|
||||
}
|
||||
|
||||
type PaymentMethodBreakdown struct {
|
||||
PaymentType string `json:"payment_type"`
|
||||
PaymentProvider string `json:"payment_provider"`
|
||||
TotalTransactions int64 `json:"total_transactions"`
|
||||
TotalAmount float64 `json:"total_amount"`
|
||||
}
|
||||
|
||||
type OrderPaymentAnalysis struct {
|
||||
TotalTransactions int64 `json:"total"`
|
||||
TotalAmount float64 `json:"total_amount"`
|
||||
PaymentMethodBreakdown []PaymentMethodBreakdown `json:"payment_method_breakdown"`
|
||||
}
|
||||
|
||||
type RevenueOverviewItem struct {
|
||||
Period string `json:"period"`
|
||||
TotalAmount float64 `json:"total_amount"`
|
||||
OrderCount int64 `json:"order_count"`
|
||||
}
|
||||
|
||||
type SalesByCategoryItem struct {
|
||||
Category string `json:"category"`
|
||||
TotalAmount float64 `json:"total_amount"`
|
||||
TotalQuantity int64 `json:"total_quantity"`
|
||||
Percentage float64 `json:"percentage"`
|
||||
}
|
||||
|
||||
type PopularProductItem struct {
|
||||
ProductID int64 `json:"product_id"`
|
||||
ProductName string `json:"product_name"`
|
||||
Category string `json:"category"`
|
||||
TotalSales int64 `json:"total_sales"`
|
||||
TotalRevenue float64 `json:"total_revenue"`
|
||||
AveragePrice float64 `json:"average_price"`
|
||||
Percentage float64 `json:"percentage"`
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package entity
|
||||
|
||||
import "time"
|
||||
|
||||
type SearchRequest struct {
|
||||
Status string // Filter by order status (e.g., "COMPLETED", "PENDING", etc.)
|
||||
Start time.Time // Start date for filtering orders
|
||||
End time.Time // End date for filtering orders
|
||||
Limit int // Maximum number of records to return
|
||||
Offset int // Number of records to skip for pagination
|
||||
}
|
||||
|
||||
type RevenueOverviewRequest struct {
|
||||
PartnerID int64
|
||||
Year int
|
||||
Granularity string // "monthly" or "weekly"
|
||||
Status string
|
||||
}
|
||||
|
||||
type SalesByCategoryRequest struct {
|
||||
PartnerID int64
|
||||
Period string // "d" (daily), "w" (weekly), "m" (monthly)
|
||||
Status string
|
||||
}
|
||||
|
||||
type PopularProductsRequest struct {
|
||||
PartnerID int64
|
||||
Period string // "d" (daily), "w" (weekly), "m" (monthly)
|
||||
Status string
|
||||
Limit int
|
||||
SortBy string // "sales" or "revenue"
|
||||
}
|
||||
Reference in New Issue
Block a user