29 lines
834 B
Rust
29 lines
834 B
Rust
|
|
// API state - Shared application state for Axum handlers
|
||
|
|
|
||
|
|
use crate::services::{AgentService, ProjectService, TaskService};
|
||
|
|
use std::sync::Arc;
|
||
|
|
|
||
|
|
/// Application state shared across all API handlers
|
||
|
|
#[derive(Clone)]
|
||
|
|
pub struct AppState {
|
||
|
|
pub project_service: Arc<ProjectService>,
|
||
|
|
pub task_service: Arc<TaskService>,
|
||
|
|
pub agent_service: Arc<AgentService>,
|
||
|
|
// TODO: Phase 4 - Add workflow_service when workflow module is ready
|
||
|
|
}
|
||
|
|
|
||
|
|
impl AppState {
|
||
|
|
/// Create a new AppState instance
|
||
|
|
pub fn new(
|
||
|
|
project_service: ProjectService,
|
||
|
|
task_service: TaskService,
|
||
|
|
agent_service: AgentService,
|
||
|
|
) -> Self {
|
||
|
|
Self {
|
||
|
|
project_service: Arc::new(project_service),
|
||
|
|
task_service: Arc::new(task_service),
|
||
|
|
agent_service: Arc::new(agent_service),
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|