🗑️ feat(token): implement batch token deletion API & front-end integration
• Back-end
• model/token.go
• Add `BatchDeleteTokens(ids []int, userId int)` – transactional DB removal + async Redis cache cleanup.
• controller/token.go
• Introduce `TokenBatch` DTO and `DeleteTokenBatch` handler calling the model layer; returns amount deleted.
• router/api-router.go
• Register `POST /api/token/batch` route (user-scoped).
• Front-end (TokensTable.js)
• Replace per-token deletion loops with single request to `/api/token/batch`.
• Display dynamic i18n message: “Deleted {{count}} tokens!”.
• Add modal confirmation:
• Title “Batch delete token”.
• Content “Are you sure you want to delete the selected {{count}} tokens?”.
• UI/UX tweaks
• Responsive button group (flex-wrap, mobile line-break).
• Clear `selectedKeys` after refresh / successful deletion to avoid ghost selections.
• i18n
• Ensure placeholder style matches translation keys (`{{count}}`).
This commit delivers efficient, scalable token management and an improved user experience across devices.
This commit is contained in:
@@ -125,6 +125,7 @@ func SetApiRouter(router *gin.Engine) {
|
||||
tokenRoute.POST("/", controller.AddToken)
|
||||
tokenRoute.PUT("/", controller.UpdateToken)
|
||||
tokenRoute.DELETE("/:id", controller.DeleteToken)
|
||||
tokenRoute.POST("/batch", controller.DeleteTokenBatch)
|
||||
}
|
||||
redemptionRoute := apiRouter.Group("/redemption")
|
||||
redemptionRoute.Use(middleware.AdminAuth())
|
||||
|
||||
Reference in New Issue
Block a user