Skip to content

Commit 7c8c027

Browse files
authored
chore: disallow sdk imports from the db package, switch enum to string(#14539)
* chore: disallow sdk imports from the db package * convert to string
1 parent 4843062 commit 7c8c027

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

coderd/database/types.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
"golang.org/x/xerrors"
1111

1212
"github.com/coder/coder/v2/coderd/rbac/policy"
13-
"github.com/coder/coder/v2/codersdk/healthsdk"
1413
)
1514

1615
// AuditOAuthConvertState is never stored in the database. It is stored in a cookie
@@ -26,8 +25,8 @@ type AuditOAuthConvertState struct {
2625
}
2726

2827
type HealthSettings struct {
29-
ID uuid.UUID `db:"id" json:"id"`
30-
DismissedHealthchecks []healthsdk.HealthSection `db:"dismissed_healthchecks" json:"dismissed_healthchecks"`
28+
ID uuid.UUID `db:"id" json:"id"`
29+
DismissedHealthchecks []string `db:"dismissed_healthchecks" json:"dismissed_healthchecks"`
3130
}
3231

3332
type NotificationsSettings struct {

coderd/debug.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"github.com/coder/coder/v2/coderd/httpmw"
2121
"github.com/coder/coder/v2/coderd/rbac"
2222
"github.com/coder/coder/v2/coderd/rbac/policy"
23+
"github.com/coder/coder/v2/coderd/util/slice"
2324
"github.com/coder/coder/v2/codersdk"
2425
"github.com/coder/coder/v2/codersdk/healthsdk"
2526
)
@@ -250,7 +251,7 @@ func (api *API) putDeploymentHealthSettings(rw http.ResponseWriter, r *http.Requ
250251

251252
aReq.New = database.HealthSettings{
252253
ID: uuid.New(),
253-
DismissedHealthchecks: settings.DismissedHealthchecks,
254+
DismissedHealthchecks: slice.ToStrings(settings.DismissedHealthchecks),
254255
}
255256

256257
err = api.Database.UpsertHealthSettings(ctx, string(settingsJSON))

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy