You've already forked agentic-coding-workflow
原型阶段
This commit is contained in:
@@ -13,13 +13,14 @@ import (
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
// Phase 是 Requirement 的五阶段枚举。phase 不强制单向流动,可任意跳跃/回退。
|
||||
// Phase 是 Requirement 的六阶段枚举。phase 不强制单向流动,可任意跳跃/回退。
|
||||
// 字符串常量保持与 DB CHECK 约束一致。
|
||||
type Phase string
|
||||
|
||||
// 五阶段枚举值,与 migrations/0002 的 CHECK 约束完全一致。
|
||||
// 六阶段枚举值,与最新 phase CHECK 约束一致(prototyping 由 migrations/0011 加入)。
|
||||
const (
|
||||
PhasePlanning Phase = "planning"
|
||||
PhasePrototyping Phase = "prototyping"
|
||||
PhaseAuditing Phase = "auditing"
|
||||
PhaseImplementing Phase = "implementing"
|
||||
PhaseReviewing Phase = "reviewing"
|
||||
@@ -27,7 +28,7 @@ const (
|
||||
)
|
||||
|
||||
// AllPhases 用于校验 phase 字符串合法性,顺序也对应前端看板/流转条的列序。
|
||||
var AllPhases = []Phase{PhasePlanning, PhaseAuditing, PhaseImplementing, PhaseReviewing, PhaseDone}
|
||||
var AllPhases = []Phase{PhasePlanning, PhasePrototyping, PhaseAuditing, PhaseImplementing, PhaseReviewing, PhaseDone}
|
||||
|
||||
// IsValid 报告 p 是否在枚举集合内。
|
||||
func (p Phase) IsValid() bool {
|
||||
@@ -114,6 +115,18 @@ type Issue struct {
|
||||
UpdatedAt time.Time
|
||||
}
|
||||
|
||||
// Prototype 是某条 Requirement 的一个原型设计版本快照。Version 在同一 Requirement
|
||||
// 内自增(max+1),CreatedBy 永远存在(DELETE RESTRICT)。
|
||||
type Prototype struct {
|
||||
ID uuid.UUID
|
||||
RequirementID uuid.UUID
|
||||
Version int
|
||||
Content string
|
||||
Note string
|
||||
CreatedBy uuid.UUID
|
||||
CreatedAt time.Time
|
||||
}
|
||||
|
||||
// Caller 表示发起请求的用户上下文。Service 层据此判定鉴权。
|
||||
type Caller struct {
|
||||
UserID uuid.UUID
|
||||
@@ -156,6 +169,13 @@ type IssueService interface {
|
||||
Reopen(ctx context.Context, c Caller, projectSlug string, number int) error
|
||||
}
|
||||
|
||||
// PrototypeService 暴露 Requirement 原型设计版本的应用服务方法。
|
||||
type PrototypeService interface {
|
||||
Create(ctx context.Context, c Caller, projectSlug string, reqNumber int, in CreatePrototypeInput) (*Prototype, error)
|
||||
List(ctx context.Context, c Caller, projectSlug string, reqNumber int) ([]*Prototype, error)
|
||||
GetByVersion(ctx context.Context, c Caller, projectSlug string, reqNumber int, version int) (*Prototype, error)
|
||||
}
|
||||
|
||||
// ===== 输入 DTO =====
|
||||
//
|
||||
// 约定(适用于全部 Update*Input):指针字段为 nil 表示"未提供,保持原值";
|
||||
@@ -220,6 +240,13 @@ type CreateIssueInput struct {
|
||||
WorkspaceID *uuid.UUID
|
||||
}
|
||||
|
||||
// CreatePrototypeInput 创建一个原型设计版本。Version 由 Service 自动计算(max+1),
|
||||
// 不在此处提供。Note 可为空字符串。
|
||||
type CreatePrototypeInput struct {
|
||||
Content string
|
||||
Note string
|
||||
}
|
||||
|
||||
// UpdateIssueInput 是 Issue 的 patch 输入。RequirementNumber 为指针的指针,承载三种状态:
|
||||
//
|
||||
// nil —— 未提供(不修改 issue.requirement_id)
|
||||
|
||||
Reference in New Issue
Block a user