summaryrefslogtreecommitdiff
path: root/makima/src/db
diff options
context:
space:
mode:
Diffstat (limited to 'makima/src/db')
-rw-r--r--makima/src/db/models.rs3
-rw-r--r--makima/src/db/repository.rs7
2 files changed, 10 insertions, 0 deletions
diff --git a/makima/src/db/models.rs b/makima/src/db/models.rs
index 99c8b8e..3e6997f 100644
--- a/makima/src/db/models.rs
+++ b/makima/src/db/models.rs
@@ -544,6 +544,8 @@ pub struct TaskSummary {
pub contract_name: Option<String>,
/// Contract phase (joined from contracts table)
pub contract_phase: Option<String>,
+ /// Contract status (joined from contracts table): 'active', 'completed', 'archived'
+ pub contract_status: Option<String>,
pub parent_task_id: Option<Uuid>,
/// Depth in task hierarchy: 0=orchestrator (top-level), 1=subtask (max)
pub depth: i32,
@@ -568,6 +570,7 @@ impl From<Task> for TaskSummary {
contract_id: task.contract_id,
contract_name: None, // Not available from Task directly
contract_phase: None, // Not available from Task directly
+ contract_status: None, // Not available from Task directly
parent_task_id: task.parent_task_id,
depth: task.depth,
name: task.name,
diff --git a/makima/src/db/repository.rs b/makima/src/db/repository.rs
index 3d1efd1..36e6bc1 100644
--- a/makima/src/db/repository.rs
+++ b/makima/src/db/repository.rs
@@ -735,6 +735,7 @@ pub async fn list_tasks(pool: &PgPool) -> Result<Vec<TaskSummary>, sqlx::Error>
r#"
SELECT
t.id, t.contract_id, c.name as contract_name, c.phase as contract_phase,
+ c.status as contract_status,
t.parent_task_id, t.depth, t.name, t.status, t.priority,
t.progress_summary,
(SELECT COUNT(*) FROM tasks WHERE parent_task_id = t.id) as subtask_count,
@@ -755,6 +756,7 @@ pub async fn list_subtasks(pool: &PgPool, parent_id: Uuid) -> Result<Vec<TaskSum
r#"
SELECT
t.id, t.contract_id, c.name as contract_name, c.phase as contract_phase,
+ c.status as contract_status,
t.parent_task_id, t.depth, t.name, t.status, t.priority,
t.progress_summary,
(SELECT COUNT(*) FROM tasks WHERE parent_task_id = t.id) as subtask_count,
@@ -1129,6 +1131,7 @@ pub async fn list_tasks_for_owner(
r#"
SELECT
t.id, t.contract_id, c.name as contract_name, c.phase as contract_phase,
+ c.status as contract_status,
t.parent_task_id, t.depth, t.name, t.status, t.priority,
t.progress_summary,
(SELECT COUNT(*) FROM tasks WHERE parent_task_id = t.id) as subtask_count,
@@ -1154,6 +1157,7 @@ pub async fn list_subtasks_for_owner(
r#"
SELECT
t.id, t.contract_id, c.name as contract_name, c.phase as contract_phase,
+ c.status as contract_status,
t.parent_task_id, t.depth, t.name, t.status, t.priority,
t.progress_summary,
(SELECT COUNT(*) FROM tasks WHERE parent_task_id = t.id) as subtask_count,
@@ -1671,6 +1675,7 @@ pub async fn list_sibling_tasks(
r#"
SELECT
t.id, t.contract_id, c.name as contract_name, c.phase as contract_phase,
+ c.status as contract_status,
t.parent_task_id, t.depth, t.name, t.status, t.priority,
t.progress_summary,
(SELECT COUNT(*) FROM tasks WHERE parent_task_id = t.id) as subtask_count,
@@ -1692,6 +1697,7 @@ pub async fn list_sibling_tasks(
r#"
SELECT
t.id, t.contract_id, c.name as contract_name, c.phase as contract_phase,
+ c.status as contract_status,
t.parent_task_id, t.depth, t.name, t.status, t.priority,
t.progress_summary,
(SELECT COUNT(*) FROM tasks WHERE parent_task_id = t.id) as subtask_count,
@@ -2669,6 +2675,7 @@ pub async fn list_tasks_in_contract(
r#"
SELECT
t.id, t.contract_id, c.name as contract_name, c.phase as contract_phase,
+ c.status as contract_status,
t.parent_task_id, t.depth, t.name, t.status, t.priority,
t.progress_summary,
(SELECT COUNT(*) FROM tasks WHERE parent_task_id = t.id) as subtask_count,