Skip to content

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

Respect project=xxx in the GET /issue endpoint

天舟9c487b4d5bdc
diff --git a/backend/api/issue.go b/backend/api/issue.go
index 2b8f5ac26d..765a6d4c8e 100644
--- a/backend/api/issue.go
+++ b/backend/api/issue.go
@@ -111,6 +111,9 @@ type IssueFind struct {
// Standard fields
WorkspaceId *int
+
+ // Related fields
+ ProjectId *int
}
type IssuePatch struct {
diff --git a/backend/server/issue.go b/backend/server/issue.go
index a11897f6e1..c114f18bb3 100644
--- a/backend/server/issue.go
+++ b/backend/server/issue.go
@@ -70,6 +70,14 @@ func (s *Server) registerIssueRoutes(g *echo.Group) {
issueFind := &api.IssueFind{
WorkspaceId: &workspaceId,
}
+ projectIdStr := c.QueryParams().Get("project")
+ if projectIdStr != "" {
+ projectId, err := strconv.Atoi(projectIdStr)
+ if err != nil {
+ return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("project query parameter is not a number: %s", projectIdStr)).SetInternal(err)
+ }
+ issueFind.ProjectId = &projectId
+ }
list, err := s.IssueService.FindIssueList(context.Background(), issueFind)
if err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to fetch issue list").SetInternal(err)
diff --git a/backend/store/issue.go b/backend/store/issue.go
index 04f1a1e960..92a7fe9900 100644
--- a/backend/store/issue.go
+++ b/backend/store/issue.go
@@ -211,6 +211,9 @@ func (s *IssueService) findIssueList(ctx context.Context, tx *Tx, find *api.Issu
if v := find.WorkspaceId; v != nil {
where, args = append(where, "workspace_id = ?"), append(args, *v)
}
+ if v := find.ProjectId; v != nil {
+ where, args = append(where, "project_id = ?"), append(args, *v)
+ }
rows, err := tx.QueryContext(ctx, `
SELECT