DeleteMultipleKeysAsync handles deleting keys from a text block within a specific group using async task.
(c *gin.Context)
| 270 | |
| 271 | // DeleteMultipleKeysAsync handles deleting keys from a text block within a specific group using async task. |
| 272 | func (s *Server) DeleteMultipleKeysAsync(c *gin.Context) { |
| 273 | var req KeyTextRequest |
| 274 | if err := c.ShouldBindJSON(&req); err != nil { |
| 275 | response.Error(c, app_errors.NewAPIError(app_errors.ErrInvalidJSON, err.Error())) |
| 276 | return |
| 277 | } |
| 278 | |
| 279 | group, ok := s.findGroupByID(c, req.GroupID) |
| 280 | if !ok { |
| 281 | return |
| 282 | } |
| 283 | |
| 284 | if !validateKeysText(c, req.KeysText) { |
| 285 | return |
| 286 | } |
| 287 | |
| 288 | taskStatus, err := s.KeyDeleteService.StartDeleteTask(group, req.KeysText) |
| 289 | if err != nil { |
| 290 | response.Error(c, app_errors.NewAPIError(app_errors.ErrTaskInProgress, err.Error())) |
| 291 | return |
| 292 | } |
| 293 | |
| 294 | response.Success(c, taskStatus) |
| 295 | } |
| 296 | |
| 297 | // RestoreMultipleKeys handles restoring keys from a text block within a specific group. |
| 298 | func (s *Server) RestoreMultipleKeys(c *gin.Context) { |
nothing calls this directly
no test coverage detected