chore: add create user route

This commit is contained in:
2026-01-21 16:26:15 +01:00
parent 88d10e96c2
commit f46a5d9652
16 changed files with 1160 additions and 527 deletions
+10 -2
View File
@@ -46,7 +46,11 @@ func DeleteAlert(c *gin.Context) {
c.JSON(http.StatusBadRequest, gin.H{"error": "ID d'alerte invalide"})
return
}
userRole := c.GetString("role")
if userRole != "livreur" && userRole != "admin" {
c.JSON(http.StatusForbidden, gin.H{"error": "Accès réservé aux livreurs"})
return
}
err = database.DeleteAlertPolicy(alertID)
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
@@ -68,7 +72,11 @@ func GetAlert(c *gin.Context) {
c.JSON(http.StatusBadRequest, gin.H{"error": "ID d'alerte invalide"})
return
}
userRole := c.GetString("role")
if userRole != "livreur" && userRole != "admin" && userRole != "cabine" {
c.JSON(http.StatusForbidden, gin.H{"error": "Accès réservé aux livreurs et aux administrateurs"})
return
}
alert, err := database.GetAlertPolicy(alertID)
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})