You've already forked agentic-coding-workflow
feat(project): add workspace_id to issue/requirement with tri-state update
This commit is contained in:
@@ -61,7 +61,8 @@ func (s *issueService) Create(ctx context.Context, c Caller, slug string, in Cre
|
||||
}
|
||||
in1 := &Issue{
|
||||
ID: uuid.New(), ProjectID: p.ID, RequirementID: reqID,
|
||||
Title: in.Title, Description: in.Description,
|
||||
WorkspaceID: in.WorkspaceID,
|
||||
Title: in.Title, Description: in.Description,
|
||||
AssigneeID: in.AssigneeID, CreatedBy: c.UserID,
|
||||
}
|
||||
out, err := s.createWithRetry(ctx, in1)
|
||||
@@ -72,6 +73,9 @@ func (s *issueService) Create(ctx context.Context, c Caller, slug string, in Cre
|
||||
if reqID != nil {
|
||||
meta["requirement_id"] = reqID.String()
|
||||
}
|
||||
if in.WorkspaceID != nil {
|
||||
meta["workspace_id"] = in.WorkspaceID.String()
|
||||
}
|
||||
s.recordAudit(ctx, c, "issue.create", out.ID.String(), meta)
|
||||
return out, nil
|
||||
}
|
||||
@@ -165,11 +169,34 @@ func (s *issueService) Update(ctx context.Context, c Caller, slug string, number
|
||||
}
|
||||
}
|
||||
|
||||
// workspace 三态:nil(未提供)/ &uuid.Nil(解绑)/ &id(关联)
|
||||
nextWS := cur.WorkspaceID
|
||||
if in.WorkspaceID != nil {
|
||||
if *in.WorkspaceID == uuid.Nil {
|
||||
nextWS = nil
|
||||
} else {
|
||||
v := *in.WorkspaceID
|
||||
nextWS = &v
|
||||
}
|
||||
auditFrom := "<none>"
|
||||
if cur.WorkspaceID != nil {
|
||||
auditFrom = cur.WorkspaceID.String()
|
||||
}
|
||||
auditTo := "<none>"
|
||||
if nextWS != nil {
|
||||
auditTo = nextWS.String()
|
||||
}
|
||||
if auditFrom != auditTo {
|
||||
changed["from_workspace"] = auditFrom
|
||||
changed["to_workspace"] = auditTo
|
||||
}
|
||||
}
|
||||
|
||||
if len(changed) == 0 {
|
||||
return cur, nil
|
||||
}
|
||||
|
||||
out, err := s.repo.UpdateIssueCore(ctx, cur.ID, title, desc, reqID)
|
||||
out, err := s.repo.UpdateIssueCore(ctx, cur.ID, title, desc, reqID, nextWS)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user