chore: fix

This commit is contained in:
2026-03-14 15:28:40 +01:00
parent 9d52f3193a
commit 0043646cff
10 changed files with 156 additions and 77 deletions
+12 -5
View File
@@ -952,16 +952,23 @@ func ResetClientPointAdmin(c *gin.Context) {
return
}
var req struct {
ResetCancellationsPoints bool `json:"reset_cancellations_points"`
Pool int `json:"pool"` // 0=pool principal, 1=pool secondaire, -1=tous (défaut)
}
if err := c.ShouldBindJSON(&req); err != nil {
req.ResetCancellationsPoints = false
req.Pool = -1 // défaut : reset total
if err := c.ShouldBindJSON(&req); err == nil {
// valeur reçue correctement
}
database := c.MustGet("database").(*db.Database)
err := database.ResetClientPoint(username, req.ResetCancellationsPoints)
extraPoolKey := ""
if req.Pool >= 2 {
if settings, err := database.GetSettings(); err == nil && req.Pool < len(settings.PointsPools) {
extraPoolKey = settings.PointsPools[req.Pool].Key
}
}
err := database.ResetClientPoint(username, req.Pool, extraPoolKey)
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{
"error": "Erreur lors de la réinitialisation",