From aa361341bd3432db97bc67eefac3e451c9c9c19e Mon Sep 17 00:00:00 2001 From: Jake Fink Date: Thu, 12 Sep 2024 13:47:04 -0400 Subject: [PATCH] [PM-10914] add endpoint to delete all folders (#4761) * add endpoint to delete all folders * await folder deletions --- src/Api/Vault/Controllers/FoldersController.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Api/Vault/Controllers/FoldersController.cs b/src/Api/Vault/Controllers/FoldersController.cs index 99a9b3e9b..da9e6760c 100644 --- a/src/Api/Vault/Controllers/FoldersController.cs +++ b/src/Api/Vault/Controllers/FoldersController.cs @@ -87,4 +87,16 @@ public class FoldersController : Controller await _cipherService.DeleteFolderAsync(folder); } + + [HttpDelete("all")] + public async Task DeleteAll() + { + var userId = _userService.GetProperUserId(User).Value; + var allFolders = await _folderRepository.GetManyByUserIdAsync(userId); + + foreach (var folder in allFolders) + { + await _cipherService.DeleteFolderAsync(folder); + } + } }