Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
fix: use type prefix filter to find activities (#1086)
Danny Xud0ea08693026
diff --git a/api/activity.go b/api/activity.goindex 9cf9a8764b..ddc07e7617 100644--- a/api/activity.go+++ b/api/activity.go@@ -292,7 +292,7 @@ type ActivityFind struct {// Domain specific fieldsCreatorID *int- Type *string+ TypePrefix *stringLevel *ActivityLevelContainerID *intLimit *intdiff --git a/frontend/src/store/pinia-modules/activity.ts b/frontend/src/store/pinia-modules/activity.tsindex cd93c830fa..8c1cf256a9 100644--- a/frontend/src/store/pinia-modules/activity.ts+++ b/frontend/src/store/pinia-modules/activity.ts@@ -84,7 +84,9 @@ export const useActivityStore = defineStore("activity", {return activityList;},async fetchActivityListForIssue(issueId: IssueId) {- const data = (await axios.get(`/api/activity?container=${issueId}`)).data;+ const queryList = ["typePrefix=bb.issue.", `container=${issueId}`];+ const data = (await axios.get(`/api/activity?${queryList.join("&")}`))+ .data;const activityList: Activity[] = data.data.map((activity: ResourceObject) => {return convert(activity, data.included);@@ -102,7 +104,7 @@ export const useActivityStore = defineStore("activity", {projectId: ProjectId;limit?: number;}) {- const queryList = [`container=${projectId}`];+ const queryList = ["typePrefix=bb.project.", `container=${projectId}`];if (limit) {queryList.push(`limit=${limit}`);}@@ -119,7 +121,7 @@ export const useActivityStore = defineStore("activity", {async fetchActivityListForQueryHistory({ limit }: { limit: number }) {const { currentUser } = useAuthStore();const queryList = [- "type=bb.sql-editor.query",+ "typePrefix=bb.sql-editor.query",`user=${currentUser.id}`,`limit=${limit}`,// only fetch the successful query historydiff --git a/server/activity.go b/server/activity.goindex bc6c17483c..b7f6976d2e 100644--- a/server/activity.go+++ b/server/activity.go@@ -74,8 +74,8 @@ func (s *Server) registerActivityRoutes(g *echo.Group) {}activityFind.CreatorID = &creatorID}- if typeStr := c.QueryParams().Get("type"); typeStr != "" {- activityFind.Type = &typeStr+ if typePrefixStr := c.QueryParams().Get("typePrefix"); typePrefixStr != "" {+ activityFind.TypePrefix = &typePrefixStr}if levelStr := c.QueryParams().Get("level"); levelStr != "" {activityLevel := api.ActivityLevel(levelStr)diff --git a/store/activity.go b/store/activity.goindex 4498a4653e..cf8fd99b44 100644--- a/store/activity.go+++ b/store/activity.go@@ -298,8 +298,8 @@ func findActivityImpl(ctx context.Context, tx *sql.Tx, find *api.ActivityFind) (if v := find.CreatorID; v != nil {where, args = append(where, fmt.Sprintf("creator_id = $%d", len(args)+1)), append(args, *v)}- if v := find.Type; v != nil {- where, args = append(where, fmt.Sprintf("type = $%d", len(args)+1)), append(args, *v)+ if v := find.TypePrefix; v != nil {+ where, args = append(where, fmt.Sprintf("type LIKE $%d", len(args)+1)), append(args, fmt.Sprintf("%s%%", *v))}if v := find.Level; v != nil {where, args = append(where, fmt.Sprintf("level = $%d", len(args)+1)), append(args, *v)