chore: fix
This commit is contained in:
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user