Skip to content

Commit

Permalink
fix: delete linked projects and webhooks on uninstall
Browse files Browse the repository at this point in the history
  • Loading branch information
slowbackspace committed Dec 20, 2023
1 parent 0af294f commit aa82857
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/services/db/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,15 @@ class DBStore {
};

deleteInstallation = async (installationId: string) => {
await this.client.none(`DELETE FROM slack_installations WHERE installation_id = $1`, [
installationId,
]);
await this.client.tx(async t => {
await t.none(`DELETE FROM slack_linked_projects WHERE installation_id = $1`, [
installationId,
]);
await t.none(`DELETE FROM slack_linked_webhooks WHERE installation_id = $1`, [
installationId,
]);
await t.none(`DELETE FROM slack_installations WHERE installation_id = $1`, [installationId]);
});
};

registerProjectId = async (installationId: string, projectId: string) => {
Expand Down

0 comments on commit aa82857

Please sign in to comment.