From 8c6339e4795a4e905bd59c25f01fcbdd376f15f9 Mon Sep 17 00:00:00 2001 From: Victor Serbu Date: Wed, 26 Nov 2025 12:58:53 +0000 Subject: [PATCH] Fix update policies --- backend/controllers/policies.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/backend/controllers/policies.go b/backend/controllers/policies.go index fed19a455..e9ad2345d 100644 --- a/backend/controllers/policies.go +++ b/backend/controllers/policies.go @@ -184,7 +184,8 @@ func upsertPolicyForOrg(c *gin.Context, policyType string) { } slog.Info("Created new policy", "organisation", organisation, "policyType", policyType) } else { - err := policyResult.Update("policy", string(policyData)).Error + policy.Policy = string(policyData) + err := models.DB.GormDB.Save(&policy).Error if err != nil { slog.Error("Error updating policy", "organisation", organisation, "policyType", policyType, "error", err) c.String(http.StatusInternalServerError, "Error updating policy") @@ -280,7 +281,8 @@ func upsertPolicyForRepoAndProject(c *gin.Context, policyType string) { } slog.Info("Created new policy for repo and project", "repo", repo, "project", projectName, "policyType", policyType) } else { - err := policyResult.Update("policy", string(policyData)).Error + policy.Policy = string(policyData) + err := models.DB.GormDB.Save(&policy).Error if err != nil { slog.Error("Error updating policy", "repo", repo, "project", projectName, "policyType", policyType, "error", err) c.String(http.StatusInternalServerError, "Error updating policy")