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
@@ -9,6 +9,7 @@ import (
"net/http"
"strconv"
"github.com/gin-gonic/gin"
)
@@ -56,7 +57,6 @@ func ValidateDeliveryByLivreur(c *gin.Context) {
log.Printf("❌ [VALIDATE_LIVREUR] Erreur JSON: %v", err)
c.JSON(http.StatusBadRequest, gin.H{
"error": "Coordonnées GPS requises",
"details": err.Error(),
})
return
}
@@ -99,7 +99,6 @@ func ValidateDeliveryByLivreur(c *gin.Context) {
log.Printf("❌ [VALIDATE_LIVREUR] Erreur update statut: %v", err)
c.JSON(http.StatusInternalServerError, gin.H{
"error": "Erreur validation",
"details": err.Error(),
})
return
}
@@ -299,7 +298,6 @@ func StartDelivery(c *gin.Context) {
if err := c.ShouldBindJSON(&req); err != nil {
c.JSON(http.StatusBadRequest, gin.H{
"error": "Coordonnées GPS requises",
"details": err.Error(),
})
return
}
@@ -336,7 +334,6 @@ func StartDelivery(c *gin.Context) {
if err := database.UpdateCommandStatus(commandID, "en_route"); err != nil {
c.JSON(http.StatusInternalServerError, gin.H{
"error": "Erreur mise à jour statut",
"details": err.Error(),
})
return
}
@@ -354,7 +351,7 @@ func StartDelivery(c *gin.Context) {
// Notifier le client
if clientUsername, _ := command["username"].(string); clientUsername != "" {
msg := fmt.Sprintf("🛵 Votre commande #%d est en route !", commandID)
msg := fmt.Sprintf("Un livreur vient de prendre en charge ta commande #%d, il est en route.", database.GetClientOrderID(commandID))
database.NotifyClient(clientUsername, commandID, "en_route", msg)
}