token.go
6.32 KB
-
🗑 ️ feat(token): implement batch token deletion API & front-end integration · 1ad9c97d• 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.t0ng7u committed