Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

fixed user deletion bug

Blue Mouse2f4de2f1aee3
diff --git a/src/user/user.controller.ts b/src/user/user.controller.ts
index a32e10c5c..0b67dc6ab 100644
--- a/src/user/user.controller.ts
+++ b/src/user/user.controller.ts
@@ -125,14 +125,15 @@ export class UserController {
select: ['id'],
})
- const pids = _join(_map(user.projects, el => `'${el.id}'`), ',')
- const query1 = `ALTER table analytics DELETE WHERE pid IN (${pids})`
- const query2 = `ALTER table customEV DELETE WHERE pid IN (${pids})`
-
try {
- await this.projectService.deleteMultiple(pids)
- await clickhouse.query(query1).toPromise()
- await clickhouse.query(query2).toPromise()
+ if (!_isEmpty(user.projects)) {
+ const pids = _join(_map(user.projects, el => `'${el.id}'`), ',')
+ const query1 = `ALTER table analytics DELETE WHERE pid IN (${pids})`
+ const query2 = `ALTER table customEV DELETE WHERE pid IN (${pids})`
+ await this.projectService.deleteMultiple(pids)
+ await clickhouse.query(query1).toPromise()
+ await clickhouse.query(query2).toPromise()
+ }
await this.userService.delete(id)
return 'Account has been deleted'