chore: build
Backend - Build & Lint / build (push) Successful in 31m4s

This commit is contained in:
Xor290
2026-10-03 13:27:01 +02:00
parent f84dc153ec
commit 2278423861
8 changed files with 288 additions and 13 deletions
+17 -8
View File
@@ -73,10 +73,11 @@ func GetMyDeliveries(c *gin.Context) {
itemsSummary := make([]gin.H, len(items))
for j, item := range items {
itemsSummary[j] = gin.H{
"produit": item["produit"],
"quantite": item["quantite"],
"prix": item["prix"],
"is_reward": item["is_reward"],
"produit": item["produit"],
"quantite": item["quantite"],
"prix": item["prix"],
"promo_discount": item["promo_discount"],
"is_reward": item["is_reward"],
}
}
@@ -155,10 +156,11 @@ func GetDeliveryDetails(c *gin.Context) {
itemsSummary := make([]gin.H, len(items))
for i, item := range items {
itemsSummary[i] = gin.H{
"produit": item["produit"],
"quantite": item["quantite"],
"prix": item["prix"],
"is_reward": item["is_reward"],
"produit": item["produit"],
"quantite": item["quantite"],
"prix": item["prix"],
"promo_discount": item["promo_discount"],
"is_reward": item["is_reward"],
}
}
@@ -173,6 +175,7 @@ func GetDeliveryDetails(c *gin.Context) {
"total_prix": command["total_prix"],
"referral_used": command["referral_used"],
"created_at": command["created_at"],
"is_new_client": isFirstOrder(command["client_order_number"]),
"client_info": clientInfo,
"items": itemsSummary,
"items_count": len(items),
@@ -623,3 +626,9 @@ func GetMyDeliveryStats(c *gin.Context) {
"today_revenue": todayRow.Revenue,
})
}
// isFirstOrder indique si la commande est la toute première du client (client_order_id == 1).
func isFirstOrder(v any) bool {
n, _ := strconv.Atoi(fmt.Sprintf("%v", v))
return n == 1
}