Skip to content

Commit

Permalink
feat: Delete associated API keys when deleting a user
Browse files Browse the repository at this point in the history
When deleting a user, also delete any associated API keys to ensure a clean and consistent data state. This prevents orphaned API keys from existing, improving security and data integrity.
  • Loading branch information
n4ze3m committed Oct 15, 2024
1 parent f0d4f9f commit 7bff567
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/ui/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "app",
"private": true,
"version": "1.11.3",
"version": "1.11.4",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dialoqbase",
"version": "1.11.3",
"version": "1.11.4",
"description": "Create chatbots with ease",
"scripts": {
"ui:dev": "pnpm run --filter ui dev",
Expand Down
5 changes: 5 additions & 0 deletions server/src/handlers/api/v1/admin/delete.handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@ export const adminDeleteUserHandler = async (
},
});
}
await tx.userApiKey.deleteMany({
where: {
user_id: request.body.user_id,
},
});
await tx.user.delete({
where: {
user_id: request.body.user_id,
Expand Down

0 comments on commit 7bff567

Please sign in to comment.