Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

feat: allow updating risk.level (#5183)

p0nye9cfaccc05f4
diff --git a/backend/api/v1/risk_service.go b/backend/api/v1/risk_service.go
index fafb0e8f63..8916691987 100644
--- a/backend/api/v1/risk_service.go
+++ b/backend/api/v1/risk_service.go
@@ -96,6 +96,8 @@ func (s *RiskService) UpdateRisk(ctx context.Context, request *v1pb.UpdateRiskRe
patch.Name = &request.Risk.Title
case "risk.active":
patch.Active = &request.Risk.Active
+ case "risk.level":
+ patch.Level = &request.Risk.Level
case "risk.expression":
patch.Expression = request.Risk.Expression
}
diff --git a/backend/store/risk.go b/backend/store/risk.go
index 81f6be5fde..5c9d9a8116 100644
--- a/backend/store/risk.go
+++ b/backend/store/risk.go
@@ -44,6 +44,7 @@ type RiskMessage struct {
type UpdateRiskMessage struct {
Name *string
Active *bool
+ Level *int64
Expression *v1alpha1.ParsedExpr
RowStatus *api.RowStatus
}
@@ -211,6 +212,9 @@ func (s *Store) UpdateRisk(ctx context.Context, patch *UpdateRiskMessage, id int
if v := patch.Active; v != nil {
set, args = append(set, fmt.Sprintf("active = $%d", len(args)+1)), append(args, *v)
}
+ if v := patch.Level; v != nil {
+ set, args = append(set, fmt.Sprintf("level = $%d", len(args)+1)), append(args, *v)
+ }
if v := patch.Expression; v != nil {
expressionBytes, err := protojson.Marshal(patch.Expression)
if err != nil {