57 lines
2.7 KiB
Go
57 lines
2.7 KiB
Go
package models
|
|
|
|
import "time"
|
|
|
|
type Command struct {
|
|
ID int `gorm:"primaryKey;autoIncrement" json:"id"`
|
|
ClientOrderID int `gorm:"column:client_order_id" json:"client_order_id"`
|
|
UserID int `gorm:"column:user_id" json:"user_id"`
|
|
Username string `gorm:"column:username" json:"username"`
|
|
Status string `gorm:"column:status" json:"status"`
|
|
Total float64 `gorm:"column:total_prix" json:"total"`
|
|
DeliveryAddress string `gorm:"column:adresse" json:"delivery_address"`
|
|
LivreurAssign string `gorm:"column:livreur_assign" json:"livreur_assign,omitempty"`
|
|
CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"`
|
|
UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at"`
|
|
}
|
|
|
|
func (Command) TableName() string { return "commandes" }
|
|
|
|
// CommandItem représente un produit dans une commande
|
|
type CommandItem struct {
|
|
ID int `gorm:"primaryKey;autoIncrement" json:"id"`
|
|
CommandID int `gorm:"column:command_id" json:"command_id"`
|
|
Produit string `gorm:"column:produit" json:"produit"`
|
|
ProductID int `gorm:"column:product_id" json:"product_id"`
|
|
Quantity float64 `gorm:"column:quantite" json:"quantity"`
|
|
Price float64 `gorm:"column:prix" json:"price"`
|
|
IsReward bool `gorm:"column:is_reward" json:"is_reward"`
|
|
RewardPoolKey string `gorm:"column:reward_pool_key" json:"reward_pool_key,omitempty"`
|
|
CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"`
|
|
UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at"`
|
|
}
|
|
|
|
type CommandLog struct {
|
|
ID int `gorm:"primaryKey;autoIncrement" json:"id"`
|
|
CommandID int `gorm:"column:command_id" json:"command_id"`
|
|
Status string `gorm:"column:status" json:"status"`
|
|
Message string `gorm:"column:message" json:"message"`
|
|
Author string `gorm:"column:author" json:"author"`
|
|
CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"`
|
|
}
|
|
|
|
func (CommandLog) TableName() string { return "command_logs" }
|
|
|
|
type CommandPriority struct {
|
|
ID int `json:"id"`
|
|
Username string `json:"username"`
|
|
Status string `json:"status"`
|
|
Address string `json:"address"`
|
|
TotalPrice float64 `json:"total_price"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
WaitingSeconds int `json:"waiting_seconds"`
|
|
WaitingMinutes int `json:"waiting_minutes"`
|
|
PriorityScore float64 `json:"priority_score"`
|
|
}
|