Skip to content

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

feat: rollback activity (#4866)

p0nyde6be645424b
diff --git a/backend/legacyapi/activity.go b/backend/legacyapi/activity.go
index 8b824ddd4a..4ae6ba22df 100644
--- a/backend/legacyapi/activity.go
+++ b/backend/legacyapi/activity.go
@@ -89,10 +89,21 @@ type ActivityIssueCreatePayload struct {
IssueName string `json:"issueName"`
}
+// TaskRollbackBy records an issue rollback activity.
+// The task with taskID in IssueID is rollbacked by the task with RollbackByTaskID in RollbackByIssueID.
+type TaskRollbackBy struct {
+ IssueID int `json:"issueId"`
+ TaskID int `json:"taskId"`
+ RollbackByIssueID int `json:"rollbackByIssueId"`
+ RollbackByTaskID int `json:"rollbackByTaskId"`
+}
+
// ActivityIssueCommentCreatePayload is the API message payloads for creating issue comments.
type ActivityIssueCommentCreatePayload struct {
ExternalApprovalEvent *ExternalApprovalEvent `json:"externalApprovalEvent,omitempty"`
+ TaskRollbackBy *TaskRollbackBy `json:"taskRollbackBy,omitempty"`
+
// Used by inbox to display info without paying the join cost
IssueName string `json:"issueName"`
}
diff --git a/backend/server/activity.go b/backend/server/activity.go
index cf69d03eea..60a2fb7998 100644
--- a/backend/server/activity.go
+++ b/backend/server/activity.go
@@ -36,9 +36,12 @@ func (s *Server) registerActivityRoutes(g *echo.Group) {
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Unable to find issue ID for creating the comment: %d", activityCreate.ContainerID))
}
- bytes, err := json.Marshal(api.ActivityIssueCommentCreatePayload{
- IssueName: issue.Title,
- })
+ var payload api.ActivityIssueCommentCreatePayload
+ if err := json.Unmarshal([]byte(activityCreate.Payload), &payload); err != nil {
+ return err
+ }
+ payload.IssueName = issue.Title
+ bytes, err := json.Marshal(payload)
if err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to construct activity payload").SetInternal(err)
}