From 2f62df1cc89a23a5bd30e1a3f68a39bcfce9665c Mon Sep 17 00:00:00 2001 From: soryu Date: Sat, 17 Jan 2026 05:37:47 +0000 Subject: Add heartbeat commits --- makima/src/server/handlers/contracts.rs | 46 +++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'makima/src/server/handlers/contracts.rs') diff --git a/makima/src/server/handlers/contracts.rs b/makima/src/server/handlers/contracts.rs index afca3d7..684ab2b 100644 --- a/makima/src/server/handlers/contracts.rs +++ b/makima/src/server/handlers/contracts.rs @@ -340,6 +340,22 @@ pub async fn create_contract( ); } + // Record history event for contract creation + let _ = repository::record_history_event( + pool, + auth.owner_id, + Some(contract.id), + None, + "contract", + Some("created"), + Some(&contract.phase), + serde_json::json!({ + "name": &contract.name, + "type": &contract.contract_type, + "description": &contract.description, + }), + ).await; + // Get the summary version with counts match repository::get_contract_summary_for_owner(pool, contract.id, auth.owner_id).await { @@ -474,6 +490,21 @@ pub async fn update_contract( tokio::spawn(async move { cleanup_contract_worktrees(&pool_clone, &state_clone, contract_id).await; }); + + // Record history event for contract completion + let _ = repository::record_history_event( + pool, + auth.owner_id, + Some(contract.id), + None, + "contract", + Some("completed"), + Some(&contract.phase), + serde_json::json!({ + "name": &contract.name, + "status": &contract.status, + }), + ).await; } // Get summary with counts @@ -1255,6 +1286,21 @@ pub async fn change_phase( } } + // Record history event for phase change + let _ = repository::record_history_event( + pool, + auth.owner_id, + Some(contract.id), + None, + "phase", + Some("changed"), + Some(&contract.phase), + serde_json::json!({ + "contractName": &contract.name, + "newPhase": &contract.phase, + }), + ).await; + // Get summary with counts match repository::get_contract_summary_for_owner(pool, contract.id, auth.owner_id).await { -- cgit v1.2.3