diff --git a/src/main/java/io/supertokens/webserver/api/bulkimport/BulkImportAPI.java b/src/main/java/io/supertokens/webserver/api/bulkimport/BulkImportAPI.java index 648e1cf45..af2a29c9c 100644 --- a/src/main/java/io/supertokens/webserver/api/bulkimport/BulkImportAPI.java +++ b/src/main/java/io/supertokens/webserver/api/bulkimport/BulkImportAPI.java @@ -211,22 +211,22 @@ protected void doDelete(HttpServletRequest req, HttpServletResponse resp) throws } try { - List deletedUserIds = BulkImport.deleteUsers(appIdentifierWithStorage, userIds); + List deletedIds = BulkImport.deleteUsers(appIdentifierWithStorage, userIds); - JsonArray deletedUserIdsJson = new JsonArray(); - JsonArray invalidUserIds = new JsonArray(); + JsonArray deletedIdsJson = new JsonArray(); + JsonArray invalidIds = new JsonArray(); for (String userId : userIds) { - if (deletedUserIds.contains(userId)) { - deletedUserIdsJson.add(new JsonPrimitive(userId)); + if (deletedIds.contains(userId)) { + deletedIdsJson.add(new JsonPrimitive(userId)); } else { - invalidUserIds.add(new JsonPrimitive(userId)); + invalidIds.add(new JsonPrimitive(userId)); } } JsonObject result = new JsonObject(); - result.add("deletedUserIds", deletedUserIdsJson); - result.add("invalidUserIds", invalidUserIds); + result.add("deletedIds", deletedIdsJson); + result.add("invalidIds", invalidIds); super.sendJsonResponse(200, result, resp); diff --git a/src/test/java/io/supertokens/test/bulkimport/apis/DeleteBulkImportUsersTest.java b/src/test/java/io/supertokens/test/bulkimport/apis/DeleteBulkImportUsersTest.java index 3ae498647..f4edc4ba3 100644 --- a/src/test/java/io/supertokens/test/bulkimport/apis/DeleteBulkImportUsersTest.java +++ b/src/test/java/io/supertokens/test/bulkimport/apis/DeleteBulkImportUsersTest.java @@ -156,16 +156,15 @@ public void shouldReturn200Response() throws Exception { request.add("ids", validIds); - JsonObject response = HttpRequestForTesting.sendJsonDELETERequest(process.getProcess(), "", "http://localhost:3567/bulk-import/users", request, 1000000, 1000000, null, Utils.getCdiVersionStringLatestForTests(), null); - response.get("deletedUserIds").getAsJsonArray().forEach(id -> { + response.get("deletedIds").getAsJsonArray().forEach(id -> { assertTrue(validIds.contains(id)); }); - assertEquals(invalidId, response.get("invalidUserIds").getAsJsonArray().get(0).getAsString()); + assertEquals(invalidId, response.get("invalidIds").getAsJsonArray().get(0).getAsString()); process.kill(); Assert.assertNotNull(process.checkOrWaitForEvent(ProcessState.PROCESS_STATE.STOPPED));