chore: refacto

This commit is contained in:
2026-04-20 19:41:52 +02:00
parent 5fc52c72ee
commit 2e9827af98
46 changed files with 497 additions and 648 deletions
+31 -16
View File
@@ -3,28 +3,43 @@ package models
import "time"
type Command struct {
ID int `json:"id"`
UserID int `json:"user_id"`
Username string `json:"username"`
Status string `json:"status"` // "pending", "assigned", "livre", "approved", "cancelled", "disabled"
Total float64 `json:"total"`
DeliveryAddress string `json:"delivery_address"` // Adresse de livraison pour cette commande
LivreurAssign string `json:"livreur_assign,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
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 `json:"id"`
CommandID int `json:"command_id"`
ProductID int `json:"product_id"`
Quantity int `json:"quantity"`
Price float64 `json:"price"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
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"`
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"`