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
+1 -11
View File
@@ -85,7 +85,6 @@ func SetCommandDestinationCoordinates(c *gin.Context) {
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{
"error": "Erreur stockage Redis",
"details": err.Error(),
})
return
}
@@ -217,7 +216,6 @@ func UpdateCommandAddressCabine(c *gin.Context) {
if err := database.UpdateCommandAddress(commandID, req.DeliveryAddress); err != nil {
c.JSON(http.StatusInternalServerError, gin.H{
"error": "Erreur lors de la mise à jour de l'adresse",
"details": err.Error(),
})
return
}
@@ -264,7 +262,6 @@ func GetLivreurPosition(c *gin.Context) {
"success": false,
"livreur": livreurUsername,
"message": "Position non disponible (GPS désactivé ou livraison terminée)",
"details": err.Error(),
})
return
}
@@ -394,7 +391,6 @@ func GetDeliveryIssues(c *gin.Context) {
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{
"error": "Erreur récupération problèmes",
"details": err.Error(),
})
return
}
@@ -431,7 +427,6 @@ func CreateDeliveryIssue(c *gin.Context) {
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{
"error": "Erreur création problème",
"details": err.Error(),
})
return
}
@@ -468,7 +463,6 @@ func UpdateDeliveryIssue(c *gin.Context) {
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{
"error": "Erreur mise à jour",
"details": err.Error(),
})
return
}
@@ -516,7 +510,6 @@ func AddDeliverySupport(c *gin.Context) {
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{
"error": "Erreur ajout support",
"details": err.Error(),
})
return
}
@@ -540,7 +533,6 @@ func GetCommandLogs(c *gin.Context) {
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{
"error": "Erreur récupération logs",
"details": err.Error(),
})
return
}
@@ -580,7 +572,6 @@ func ForceValidateDelivery(c *gin.Context) {
if err := c.ShouldBindJSON(&req); err != nil {
c.JSON(http.StatusBadRequest, gin.H{
"error": "Raison requise pour validation forcée",
"details": err.Error(),
"example": gin.H{
"reason": "Client confirmé par téléphone",
},
@@ -632,7 +623,6 @@ func ForceValidateDelivery(c *gin.Context) {
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{
"error": "Erreur lors de la validation forcée",
"details": err.Error(),
})
return
}
@@ -641,7 +631,7 @@ func ForceValidateDelivery(c *gin.Context) {
livreurAssign, _ := command["livreur_assign"].(string)
if clientUsername != "" {
clientMsg := fmt.Sprintf("Votre commande #%d a été livrée. Merci !", commandID)
clientMsg := fmt.Sprintf("Ta commande #%d a bien été livrée ! Bonne dégustation l'ami et à bientôt 😊", database.GetClientOrderID(commandID))
database.NotifyClient(clientUsername, commandID, "livre", clientMsg)
}