mirror of
https://fast.feibisi.com/https://github.com/parcelvoy/platform.git
synced 2025-09-04 12:56:14 +08:00
chore: improve user deletion flow
This commit is contained in:
parent
1cb7a72679
commit
a5190a5be3
2 changed files with 10 additions and 9 deletions
|
@ -20,6 +20,7 @@ export default (config: ClickhouseConfig) => {
|
|||
wait_for_async_insert: 0,
|
||||
async_insert_deduplicate: 1,
|
||||
async_insert_busy_timeout_ms: 1000,
|
||||
lightweight_deletes_sync: 0,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
|
|
@ -170,21 +170,21 @@ export const deleteUser = async (projectId: number, externalId: string): Promise
|
|||
id: user.id,
|
||||
})
|
||||
|
||||
// Delete the user events from ClickHouse
|
||||
await UserEvent.clickhouse().delete('project_id = {projectId: UInt32} AND user_id = {userId: UInt32}', {
|
||||
projectId,
|
||||
userId: user.id,
|
||||
})
|
||||
// Delete the user events from the database
|
||||
await UserEvent.delete(qb => qb.where('project_id', projectId)
|
||||
.where('user_id', user.id),
|
||||
)
|
||||
|
||||
// Delete the user from the database
|
||||
await User.delete(qb => qb.where('project_id', projectId)
|
||||
.where('id', user.id),
|
||||
)
|
||||
|
||||
// Delete the user events from the database
|
||||
await UserEvent.delete(qb => qb.where('project_id', projectId)
|
||||
.where('user_id', user.id),
|
||||
)
|
||||
// Delete the user events from ClickHouse
|
||||
await UserEvent.clickhouse().delete('project_id = {projectId: UInt32} AND user_id = {userId: UInt32}', {
|
||||
projectId,
|
||||
userId: user.id,
|
||||
})
|
||||
}
|
||||
|
||||
export const saveDevice = async (projectId: number, { external_id, anonymous_id, ...params }: DeviceParams, trx?: Transaction): Promise<Device | undefined> => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue