From 67bb7d4b9c9bb2fb487778f9e272da5b359c54bc Mon Sep 17 00:00:00 2001 From: Jonas L Date: Mon, 15 Apr 2019 00:00:00 +0000 Subject: [PATCH] Delete app activities when deleting device --- src/function/device/remove-device.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/function/device/remove-device.ts b/src/function/device/remove-device.ts index 945ff04..43e1ff6 100644 --- a/src/function/device/remove-device.ts +++ b/src/function/device/remove-device.ts @@ -49,6 +49,14 @@ export async function removeDevice ({ database, familyId, deviceId, websocket }: transaction }) + await database.appActivity.destroy({ + where: { + familyId, + deviceId + }, + transaction + }) + // remove as current device await database.user.update({ currentDevice: ''