Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
Assign issue id to the task status change activity from the server instead of getting it from the client
天舟28753d11dc83
diff --git a/backend/api/issue.go b/backend/api/issue.goindex 6ed7c59f28..312753eaca 100644--- a/backend/api/issue.go+++ b/backend/api/issue.go@@ -119,6 +119,7 @@ type IssueFind struct {ProjectId *int// Domain specific fields+ PipelineId *int// Find issue where principalId is either creator or assignee// TODO: Add subscriber supportPrincipalId *intdiff --git a/backend/api/task.go b/backend/api/task.goindex 0d42a70c48..51702d35e1 100644--- a/backend/api/task.go+++ b/backend/api/task.go@@ -122,8 +122,7 @@ func (find *TaskFind) String() string {type TaskApprove struct {// Domain specific fields- ContainerId int `jsonapi:"attr,containerId"`- Comment string `jsonapi:"attr,comment"`+ Comment string `jsonapi:"attr,comment"`}type TaskStatusPatch struct {@@ -135,9 +134,8 @@ type TaskStatusPatch struct {WorkspaceId int// Domain specific fields- Status TaskStatus `jsonapi:"attr,status"`- ContainerId int `jsonapi:"attr,containerId"`- Comment string `jsonapi:"attr,comment"`+ Status TaskStatus `jsonapi:"attr,status"`+ Comment string `jsonapi:"attr,comment"`}type TaskService interface {diff --git a/backend/server/task.go b/backend/server/task.goindex a72b0e735f..94d7bcac63 100644--- a/backend/server/task.go+++ b/backend/server/task.go@@ -99,7 +99,6 @@ func (s *Server) registerTaskRoutes(g *echo.Group) {UpdaterId: c.Get(GetPrincipalIdContextKey()).(int),WorkspaceId: api.DEFAULT_WORKPSACE_ID,Status: api.TaskPending,- ContainerId: taskApprove.ContainerId,Comment: taskApprove.Comment,}updatedTask, err := s.ChangeTaskStatusWithPatch(context.Background(), task, taskStatusPatch)@@ -189,7 +188,6 @@ func (s *Server) ChangeTaskStatus(ctx context.Context, task *api.Task, newStatusUpdaterId: updatorId,WorkspaceId: task.WorkspaceId,Status: newStatus,- ContainerId: task.PipelineId,}return s.ChangeTaskStatusWithPatch(ctx, task, taskStatusPatch)}@@ -234,10 +232,20 @@ func (s *Server) ChangeTaskStatusWithPatch(ctx context.Context, task *api.Task,return nil, fmt.Errorf("failed to marshal activity after changing the task status: %v, err: %w", task.Name, err)}+ // TODO: This indiciates a coupling that pipeline belongs to an issue.+ // A better way is to implement this as an onTaskStatusChange callback+ issueFind := &api.IssueFind{+ PipelineId: &task.PipelineId,+ }+ issue, err := s.IssueService.FindIssue(context.Background(), issueFind)+ if err != nil {+ return nil, fmt.Errorf("failed to fetch containing issue for creating activity after changing the task status: %v, err: %w", task.Name, err)+ }+activityCreate := &api.ActivityCreate{CreatorId: taskStatusPatch.UpdaterId,WorkspaceId: api.DEFAULT_WORKPSACE_ID,- ContainerId: taskStatusPatch.ContainerId,+ ContainerId: issue.ID,Type: api.ActivityPipelineTaskStatusUpdate,Comment: taskStatusPatch.Comment,Payload: payload,diff --git a/backend/store/issue.go b/backend/store/issue.goindex c66217c2be..88a24a3208 100644--- a/backend/store/issue.go+++ b/backend/store/issue.go@@ -212,6 +212,9 @@ func (s *IssueService) findIssueList(ctx context.Context, tx *Tx, find *api.Issuif v := find.WorkspaceId; v != nil {where, args = append(where, "workspace_id = ?"), append(args, *v)}+ if v := find.PipelineId; v != nil {+ where, args = append(where, "pipeline_id = ?"), append(args, *v)+ }if v := find.ProjectId; v != nil {where, args = append(where, "project_id = ?"), append(args, *v)}diff --git a/frontend/src/components/IssueStatusTransitionButtonGroup.vue b/frontend/src/components/IssueStatusTransitionButtonGroup.vueindex 6c522e3fdd..5f3987e468 100644--- a/frontend/src/components/IssueStatusTransitionButtonGroup.vue+++ b/frontend/src/components/IssueStatusTransitionButtonGroup.vue@@ -277,7 +277,6 @@ export default {if (transition.type == "APPROVE") {const taskApprove: TaskApprove = {updaterId: currentUser.value.id,- containerId: (props.issue as Issue).id,comment: comment ? comment.trim() : undefined,};@@ -290,7 +289,6 @@ export default {} else {const taskStatusPatch: TaskStatusPatch = {updaterId: currentUser.value.id,- containerId: (props.issue as Issue).id,status: transition.to,comment: comment ? comment.trim() : undefined,};diff --git a/frontend/src/types/pipeline.ts b/frontend/src/types/pipeline.tsindex 0e64e72318..6bad5d746f 100644--- a/frontend/src/types/pipeline.ts+++ b/frontend/src/types/pipeline.ts@@ -71,7 +71,6 @@import { Database } from "./database";import { Environment } from "./environment";import {- ContainerId,DatabaseId,EnvironmentId,PipelineId,@@ -240,8 +239,6 @@ export type TaskStatusPatch = {updaterId: PrincipalId;// Domain specific fields- // This is the id for the container such as issue containing the pipeline this task belongs.- containerId: ContainerId;status: TaskStatus;comment?: string;};@@ -251,8 +248,6 @@ export type TaskApprove = {updaterId: PrincipalId;// Domain specific fields- // This is the id for the container such as issue containing the pipeline this task belongs.- containerId: ContainerId;comment?: string;};