From d33b31d5615e936093e33b4eecf9119c075f130b Mon Sep 17 00:00:00 2001 From: Steven Masley Date: Tue, 3 Sep 2024 10:16:55 -0500 Subject: [PATCH 1/2] chore: disallow sdk imports from the db package --- coderd/database/types.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/coderd/database/types.go b/coderd/database/types.go index 7113b09e14a70..f6cf87db14ec7 100644 --- a/coderd/database/types.go +++ b/coderd/database/types.go @@ -10,7 +10,6 @@ import ( "golang.org/x/xerrors" "github.com/coder/coder/v2/coderd/rbac/policy" - "github.com/coder/coder/v2/codersdk/healthsdk" ) // AuditOAuthConvertState is never stored in the database. It is stored in a cookie @@ -26,8 +25,8 @@ type AuditOAuthConvertState struct { } type HealthSettings struct { - ID uuid.UUID `db:"id" json:"id"` - DismissedHealthchecks []healthsdk.HealthSection `db:"dismissed_healthchecks" json:"dismissed_healthchecks"` + ID uuid.UUID `db:"id" json:"id"` + DismissedHealthchecks []string `db:"dismissed_healthchecks" json:"dismissed_healthchecks"` } type NotificationsSettings struct { From b15588db628ee09dde2e1ab76f81d590e363926a Mon Sep 17 00:00:00 2001 From: Steven Masley Date: Tue, 3 Sep 2024 10:19:32 -0500 Subject: [PATCH 2/2] convert to string --- coderd/debug.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/coderd/debug.go b/coderd/debug.go index f13656886295e..a34e211ef00b9 100644 --- a/coderd/debug.go +++ b/coderd/debug.go @@ -20,6 +20,7 @@ import ( "github.com/coder/coder/v2/coderd/httpmw" "github.com/coder/coder/v2/coderd/rbac" "github.com/coder/coder/v2/coderd/rbac/policy" + "github.com/coder/coder/v2/coderd/util/slice" "github.com/coder/coder/v2/codersdk" "github.com/coder/coder/v2/codersdk/healthsdk" ) @@ -250,7 +251,7 @@ func (api *API) putDeploymentHealthSettings(rw http.ResponseWriter, r *http.Requ aReq.New = database.HealthSettings{ ID: uuid.New(), - DismissedHealthchecks: settings.DismissedHealthchecks, + DismissedHealthchecks: slice.ToStrings(settings.DismissedHealthchecks), } err = api.Database.UpsertHealthSettings(ctx, string(settingsJSON))