mirror of
https://github.com/EZ-Api/ez-api.git
synced 2026-01-13 17:47:51 +00:00
fix: delete keys and seed only active ones
Ensure admin key deletion removes the DB record and returns a "deleted" status. Update seeder idempotency to count only active keys when deciding whether to skip or create new keys.
This commit is contained in:
@@ -516,8 +516,8 @@ func (h *AdminHandler) ListKeysForMaster(c *gin.Context) {
|
||||
}
|
||||
|
||||
// DeleteKeyForMaster godoc
|
||||
// @Summary Delete (revoke) child key
|
||||
// @Description Suspends a child key under the specified master
|
||||
// @Summary Delete child key
|
||||
// @Description Revokes and removes a child key under the specified master
|
||||
// @Tags admin
|
||||
// @Produce json
|
||||
// @Security AdminAuth
|
||||
@@ -561,5 +561,10 @@ func (h *AdminHandler) DeleteKeyForMaster(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
c.JSON(http.StatusOK, gin.H{"status": "revoked"})
|
||||
if err := h.db.Delete(&k).Error; err != nil {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to delete token", "details": err.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
c.JSON(http.StatusOK, gin.H{"status": "deleted"})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user