add_dependency

Function add_dependency 

Source
pub async fn add_dependency(
    pool: &SqlitePool,
    blocking_task_id: i64,
    blocked_task_id: i64,
) -> Result<Dependency>
Expand description

Add a dependency between two tasks after checking for circular dependencies.

This is the safe way to add dependencies. It will:

  1. Verify both tasks exist
  2. Check for circular dependencies
  3. Add the dependency if safe

§Arguments

  • pool - Database connection pool
  • blocking_task_id - ID of the task that must be completed first
  • blocked_task_id - ID of the task that depends on the blocking task

§Returns

  • Ok(Dependency) if the dependency was added successfully
  • Err(IntentError::CircularDependency) if adding would create a cycle
  • Err(IntentError::TaskNotFound) if either task doesn’t exist