From 150ea7710fee2b2da973a48c297674e6fc83b4ab Mon Sep 17 00:00:00 2001 From: Aminejv Date: Mon, 2 Aug 2021 17:15:28 +0100 Subject: [PATCH] feat(survey): delete survey when deleting a user --- node_common/data/methods/delete-user-by-id.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/node_common/data/methods/delete-user-by-id.js b/node_common/data/methods/delete-user-by-id.js index a3cd803d..1ac905e1 100644 --- a/node_common/data/methods/delete-user-by-id.js +++ b/node_common/data/methods/delete-user-by-id.js @@ -35,7 +35,9 @@ export default async ({ id }) => { .orWhere({ userId: id }) .del(); - const usage = await DB.from("usage").where("userId", id).del(); + const usage = await DB.from("usage").where({ userId: id }).del(); + + const surveys = await DB.from("surveys").where({ ownerId: id }).del(); const data = await DB.from("users").where({ id }).del().returning("*");