chore: fix

This commit is contained in:
2026-05-01 20:58:51 +02:00
parent 46b287c960
commit b34c239415
12 changed files with 87 additions and 24 deletions
+4 -3
View File
@@ -1047,7 +1047,8 @@ func DeleteCommandItem(c *gin.Context) {
func UpdateCommandStatusAdmin(c *gin.Context) {
database := c.MustGet("database").(*db.Database)
if c.GetString("role") != "admin" {
role := c.GetString("role")
if role != "admin" && role != "cabine" {
c.JSON(http.StatusForbidden, gin.H{"error": "Accès refusé"})
return
}
@@ -1068,7 +1069,7 @@ func UpdateCommandStatusAdmin(c *gin.Context) {
allowed := map[string]bool{
"pending": true, "assigned": true, "en_route": true,
"livre": true, "approved": true, "cancelled": true,
"arrived": true, "livre": true, "approved": true, "cancelled": true,
}
if !allowed[req.Status] {
c.JSON(http.StatusBadRequest, gin.H{"error": "Statut invalide: " + req.Status})
@@ -1080,7 +1081,7 @@ func UpdateCommandStatusAdmin(c *gin.Context) {
return
}
log.Printf("✅ [STATUS_ADMIN] Cmd %d → %s", commandID, req.Status)
log.Printf("✅ [STATUS_ADMIN] Cmd %d → %s (par %s)", commandID, req.Status, role)
c.JSON(http.StatusOK, gin.H{
"success": true,
"message": "Statut mis à jour",