summaryrefslogtreecommitdiff
path: root/makima/src/server
diff options
context:
space:
mode:
authorsoryu <soryu@soryu.co>2026-02-07 16:58:38 +0000
committersoryu <soryu@soryu.co>2026-02-07 16:58:38 +0000
commit8f757f561eeb397aaea70d7c10d41445cc5e50b5 (patch)
treedb64ab219594f069a9f0e11ff0cba10eeb80f862 /makima/src/server
parent1b72449496ce3a057a43d002c8042d5e7a1d6576 (diff)
downloadsoryu-8f757f561eeb397aaea70d7c10d41445cc5e50b5.tar.gz
soryu-8f757f561eeb397aaea70d7c10d41445cc5e50b5.zip
Show directive init on frontend
Diffstat (limited to 'makima/src/server')
-rw-r--r--makima/src/server/handlers/directives.rs21
1 files changed, 19 insertions, 2 deletions
diff --git a/makima/src/server/handlers/directives.rs b/makima/src/server/handlers/directives.rs
index 560151b..a877c6b 100644
--- a/makima/src/server/handlers/directives.rs
+++ b/makima/src/server/handlers/directives.rs
@@ -9,7 +9,7 @@ use axum::{
use uuid::Uuid;
use crate::db::models::{
- ChainWithSteps, CreateDirectiveRequest, Directive, DirectiveChain,
+ ChainStep, ChainWithSteps, CreateDirectiveRequest, Directive, DirectiveChain,
DirectiveListResponse, DirectiveWithChains, UpdateDirectiveRequest,
};
use crate::db::repository::{self, RepositoryError};
@@ -122,7 +122,24 @@ pub async fn get_directive(
}
};
- Json(DirectiveWithChains { directive, chains }).into_response()
+ // Build chains with steps
+ let mut chains_with_steps = Vec::new();
+ for chain in chains {
+ let steps = match repository::list_steps_for_chain(pool, chain.id).await {
+ Ok(s) => s,
+ Err(e) => {
+ tracing::warn!("Failed to get steps for chain {}: {}", chain.id, e);
+ Vec::new()
+ }
+ };
+ chains_with_steps.push(ChainWithSteps { chain, steps });
+ }
+
+ Json(DirectiveWithChains {
+ directive,
+ chains: chains_with_steps,
+ })
+ .into_response()
}
/// Create a new directive.