diff options
Diffstat (limited to 'makima/src/db/models.rs')
| -rw-r--r-- | makima/src/db/models.rs | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/makima/src/db/models.rs b/makima/src/db/models.rs index 44af939..18f3435 100644 --- a/makima/src/db/models.rs +++ b/makima/src/db/models.rs @@ -539,6 +539,13 @@ pub struct Task { /// Directive step this task executes #[serde(skip_serializing_if = "Option::is_none")] pub directive_step_id: Option<Uuid>, + /// Directive document this task is an artifact of. Set when the + /// orchestrator (or any task-creation path) knows which document + /// triggered the work — so when that document ships, the sidebar can + /// move its tasks alongside it under shipped/. Nullable for legacy / + /// non-directive tasks. + #[serde(skip_serializing_if = "Option::is_none")] + pub directive_document_id: Option<Uuid>, } impl Task { @@ -2778,6 +2785,11 @@ pub struct DirectiveStep { pub started_at: Option<DateTime<Utc>>, pub completed_at: Option<DateTime<Utc>>, pub created_at: DateTime<Utc>, + /// Directive document this step belongs to. When the document ships, its + /// steps move with it under shipped/. Nullable for legacy steps and for + /// directives that don't yet have a document. + #[serde(skip_serializing_if = "Option::is_none")] + pub directive_document_id: Option<Uuid>, } /// Directive with its steps for detail view. @@ -2902,6 +2914,11 @@ pub struct CreateDirectiveStepRequest { /// Valid values: "simple", "specification", "execute" #[serde(default)] pub contract_type: Option<String>, + /// Optional: attach this step to a specific directive document. When + /// omitted, the repository falls back to the directive's most-recently + /// updated active document (if any). + #[serde(default)] + pub directive_document_id: Option<Uuid>, } /// Request to update a directive step. @@ -2918,6 +2935,32 @@ pub struct UpdateDirectiveStepRequest { } // ============================================================================= +// Directive Document Types +// ============================================================================= + +/// A directive document — one of N markdown documents owned by a directive. +/// The user calls these "directive contracts". Each document has its own +/// lifecycle (draft → active → shipped → archived) and may be attached to a +/// PR. Multiple documents can be active under the same directive at once. +#[derive(Debug, Clone, FromRow, Serialize, Deserialize, ToSchema)] +#[serde(rename_all = "camelCase")] +pub struct DirectiveDocument { + pub id: Uuid, + pub directive_id: Uuid, + pub title: String, + pub body: String, + /// Status: draft, active, shipped, archived + pub status: String, + pub pr_url: Option<String>, + pub pr_branch: Option<String>, + pub shipped_at: Option<DateTime<Utc>>, + pub archived_at: Option<DateTime<Utc>>, + pub version: i32, + pub created_at: DateTime<Utc>, + pub updated_at: DateTime<Utc>, +} + +// ============================================================================= // Order Types // ============================================================================= |
