Skip to content

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

chore: cleanup issue patch (#4398)

Danny Xu4a19fe25df7a
diff --git a/backend/legacyapi/issue.go b/backend/legacyapi/issue.go
index e5f834c8d9..498794473c 100644
--- a/backend/legacyapi/issue.go
+++ b/backend/legacyapi/issue.go
@@ -234,16 +234,7 @@ type IssueFind struct {
// IssuePatch is the API message for patching an issue.
type IssuePatch struct {
- ID int `jsonapi:"primary,issuePatch"`
-
- // Standard fields
- // Value is assigned from the jwt subject field passed by the client.
- UpdaterID int
-
- // Domain specific fields
- Name *string `jsonapi:"attr,name"`
- // Status is only set manually via IssueStatusPatch
- Status *IssueStatus
+ Name *string `jsonapi:"attr,name"`
Description *string `jsonapi:"attr,description"`
AssigneeID *int `jsonapi:"attr,assigneeId"`
AssigneeNeedAttention *bool `jsonapi:"attr,assigneeNeedAttention"`
diff --git a/backend/server/issue.go b/backend/server/issue.go
index d39e0da2ef..77c9b09059 100644
--- a/backend/server/issue.go
+++ b/backend/server/issue.go
@@ -174,10 +174,7 @@ func (s *Server) registerIssueRoutes(g *echo.Group) {
}
updaterID := c.Get(getPrincipalIDContextKey()).(int)
- issuePatch := &api.IssuePatch{
- ID: id,
- UpdaterID: updaterID,
- }
+ issuePatch := &api.IssuePatch{}
if err := jsonapi.UnmarshalPayload(c.Request().Body, issuePatch); err != nil {
return echo.NewHTTPError(http.StatusBadRequest, "Malformed update issue request").SetInternal(err)
}
diff --git a/backend/tests/external_approval_test.go b/backend/tests/external_approval_test.go
index 7616970a27..52d9e3cdf7 100644
--- a/backend/tests/external_approval_test.go
+++ b/backend/tests/external_approval_test.go
@@ -142,8 +142,7 @@ func TestExternalApprovalFeishu_AllUserCanBeFound(t *testing.T) {
a.NoError(err)
attention := true
- issue, err = ctl.patchIssue(api.IssuePatch{
- ID: issue.ID,
+ issue, err = ctl.patchIssue(issue.ID, api.IssuePatch{
AssigneeNeedAttention: &attention,
})
a.NoError(err)
@@ -297,8 +296,7 @@ func TestExternalApprovalFeishu_AssigneeCanBeFound(t *testing.T) {
a.NoError(err)
attention := true
- issue, err = ctl.patchIssue(api.IssuePatch{
- ID: issue.ID,
+ issue, err = ctl.patchIssue(issue.ID, api.IssuePatch{
AssigneeNeedAttention: &attention,
})
a.NoError(err)
diff --git a/backend/tests/issue.go b/backend/tests/issue.go
index dffbf5fb87..36e5d725a7 100644
--- a/backend/tests/issue.go
+++ b/backend/tests/issue.go
@@ -92,13 +92,13 @@ func (ctl *controller) getOnePageIssuesWithToken(issueFind api.IssueFind, token
return issueResp.Issues, issueResp.NextToken, nil
}
-func (ctl *controller) patchIssue(issuePatch api.IssuePatch) (*api.Issue, error) {
+func (ctl *controller) patchIssue(uid int, issuePatch api.IssuePatch) (*api.Issue, error) {
buf := new(bytes.Buffer)
if err := jsonapi.MarshalPayload(buf, &issuePatch); err != nil {
return nil, errors.Wrap(err, "failed to marshal issue patch")
}
- body, err := ctl.patch(fmt.Sprintf("/issue/%d", issuePatch.ID), buf)
+ body, err := ctl.patch(fmt.Sprintf("/issue/%d", uid), buf)
if err != nil {
return nil, err
}