Skip to content

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

Respect rowstatus query parameter for GET /environment /instance /project

天舟71f34158697d
diff --git a/backend/api/environment.go b/backend/api/environment.go
index 7d34ce9647..b66f801f0c 100644
--- a/backend/api/environment.go
+++ b/backend/api/environment.go
@@ -34,6 +34,7 @@ type EnvironmentFind struct {
ID *int
// Standard fields
+ RowStatus *RowStatus
WorkspaceId *int
}
diff --git a/backend/api/instance.go b/backend/api/instance.go
index e115139345..72a457bc39 100644
--- a/backend/api/instance.go
+++ b/backend/api/instance.go
@@ -49,6 +49,7 @@ type InstanceFind struct {
ID *int
// Standard fields
+ RowStatus *RowStatus
WorkspaceId *int
}
diff --git a/backend/api/project.go b/backend/api/project.go
index 50d825700b..f0b0c82608 100644
--- a/backend/api/project.go
+++ b/backend/api/project.go
@@ -38,6 +38,7 @@ type ProjectFind struct {
ID *int
// Standard fields
+ RowStatus *RowStatus
WorkspaceId *int
// Domain specific fields
diff --git a/backend/server/environment.go b/backend/server/environment.go
index 4a5b3429f2..518b2e8593 100644
--- a/backend/server/environment.go
+++ b/backend/server/environment.go
@@ -46,6 +46,10 @@ func (s *Server) registerEnvironmentRoutes(g *echo.Group) {
environmentFind := &api.EnvironmentFind{
WorkspaceId: &workspaceId,
}
+ if rowStatusStr := c.QueryParam("rowstatus"); rowStatusStr != "" {
+ rowStatus := api.RowStatus(rowStatusStr)
+ environmentFind.RowStatus = &rowStatus
+ }
list, err := s.EnvironmentService.FindEnvironmentList(context.Background(), environmentFind)
if err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to fetch environment list").SetInternal(err)
diff --git a/backend/server/instance.go b/backend/server/instance.go
index 2a6449b283..2fc93391f4 100644
--- a/backend/server/instance.go
+++ b/backend/server/instance.go
@@ -46,6 +46,10 @@ func (s *Server) registerInstanceRoutes(g *echo.Group) {
instanceFind := &api.InstanceFind{
WorkspaceId: &workspaceId,
}
+ if rowStatusStr := c.QueryParam("rowstatus"); rowStatusStr != "" {
+ rowStatus := api.RowStatus(rowStatusStr)
+ instanceFind.RowStatus = &rowStatus
+ }
list, err := s.InstanceService.FindInstanceList(context.Background(), instanceFind)
if err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to fetch instance list").SetInternal(err)
diff --git a/backend/server/project.go b/backend/server/project.go
index 45c3f88f11..1342e91231 100644
--- a/backend/server/project.go
+++ b/backend/server/project.go
@@ -50,6 +50,10 @@ func (s *Server) registerProjectRoutes(g *echo.Group) {
}
projectFind.PrincipalId = &userId
}
+ if rowStatusStr := c.QueryParam("rowstatus"); rowStatusStr != "" {
+ rowStatus := api.RowStatus(rowStatusStr)
+ projectFind.RowStatus = &rowStatus
+ }
list, err := s.ProjectService.FindProjectList(context.Background(), projectFind)
if err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to fetch project list").SetInternal(err)
diff --git a/backend/store/environment.go b/backend/store/environment.go
index e239e2f798..a09ad2066a 100644
--- a/backend/store/environment.go
+++ b/backend/store/environment.go
@@ -176,6 +176,9 @@ func (s *EnvironmentService) findEnvironmentList(ctx context.Context, tx *Tx, fi
if v := find.ID; v != nil {
where, args = append(where, "id = ?"), append(args, *v)
}
+ if v := find.RowStatus; v != nil {
+ where, args = append(where, "row_status = ?"), append(args, *v)
+ }
if v := find.WorkspaceId; v != nil {
where, args = append(where, "workspace_id = ?"), append(args, *v)
}
diff --git a/backend/store/instance.go b/backend/store/instance.go
index f947968f86..2d0e51d829 100644
--- a/backend/store/instance.go
+++ b/backend/store/instance.go
@@ -162,6 +162,9 @@ func findInstanceList(ctx context.Context, tx *Tx, find *api.InstanceFind) (_ []
if v := find.ID; v != nil {
where, args = append(where, "id = ?"), append(args, *v)
}
+ if v := find.RowStatus; v != nil {
+ where, args = append(where, "row_status = ?"), append(args, *v)
+ }
if v := find.WorkspaceId; v != nil {
where, args = append(where, "workspace_id = ?"), append(args, *v)
}
diff --git a/backend/store/project.go b/backend/store/project.go
index 61d640b6ec..f13f6d4ccf 100644
--- a/backend/store/project.go
+++ b/backend/store/project.go
@@ -154,6 +154,9 @@ func findProjectList(ctx context.Context, tx *Tx, find *api.ProjectFind) (_ []*a
if v := find.ID; v != nil {
where, args = append(where, "id = ?"), append(args, *v)
}
+ if v := find.RowStatus; v != nil {
+ where, args = append(where, "row_status = ?"), append(args, *v)
+ }
if v := find.WorkspaceId; v != nil {
where, args = append(where, "workspace_id = ?"), append(args, *v)
}