From 8bed3614ee46f81dcd3bb8f312b0a944186bf770 Mon Sep 17 00:00:00 2001 From: LordMathis Date: Sat, 30 Nov 2024 00:12:14 +0100 Subject: [PATCH] Fix user deletion handler --- server/internal/handlers/user_handlers.go | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/server/internal/handlers/user_handlers.go b/server/internal/handlers/user_handlers.go index 4a0a7d9..210dd64 100644 --- a/server/internal/handlers/user_handlers.go +++ b/server/internal/handlers/user_handlers.go @@ -1,7 +1,6 @@ package handlers import ( - "database/sql" "encoding/json" "net/http" @@ -155,18 +154,6 @@ func (h *Handler) DeleteAccount() http.HandlerFunc { } } - // Start transaction for consistent deletion - tx, err := h.DB.Begin() - if err != nil { - http.Error(w, "Failed to start transaction", http.StatusInternalServerError) - return - } - defer func() { - if err := tx.Rollback(); err != nil && err != sql.ErrTxDone { - http.Error(w, "Failed to rollback transaction", http.StatusInternalServerError) - } - }() - // Get user's workspaces for cleanup workspaces, err := h.DB.GetWorkspacesByUserID(ctx.UserID) if err != nil { @@ -188,11 +175,6 @@ func (h *Handler) DeleteAccount() http.HandlerFunc { return } - if err := tx.Commit(); err != nil { - http.Error(w, "Failed to commit transaction", http.StatusInternalServerError) - return - } - respondJSON(w, map[string]string{"message": "Account deleted successfully"}) } }