Break up 'types' module
This commit is contained in:
parent
c6f9ea667d
commit
db8c02df04
36 changed files with 382 additions and 329 deletions
|
|
@ -1,9 +1,7 @@
|
|||
use axum::response::IntoResponse as _;
|
||||
use axum::{body::Body, extract::Path, http::Response, response::Redirect};
|
||||
|
||||
use crate::syntax::content;
|
||||
|
||||
use crate::{syntax::serial::populate_graph, router::handlers, types::Node};
|
||||
use crate::{syntax::serial::populate_graph, router::handlers, graph::Node};
|
||||
|
||||
pub async fn node(Path(id): Path<String>) -> Response<Body> {
|
||||
let graph = populate_graph();
|
||||
|
|
@ -29,7 +27,6 @@ pub async fn node(Path(id): Path<String>) -> Response<Body> {
|
|||
let mut context = tera::Context::default();
|
||||
context.insert("node", &node);
|
||||
context.insert("nodes", &nodes);
|
||||
context.insert("text", &content::parse(&node.text, &graph));
|
||||
context.insert("incoming", &graph.incoming.get(&id));
|
||||
context.insert("config", &graph.meta.config);
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ use axum::{
|
|||
Form,
|
||||
};
|
||||
|
||||
use crate::{syntax::serial::populate_graph, router::handlers, types::Node};
|
||||
use crate::{syntax::serial::populate_graph, router::handlers, graph::Node};
|
||||
|
||||
#[expect(clippy::unused_async)]
|
||||
pub async fn page(template: &str) -> Response<Body> {
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ mod tests {
|
|||
fn render_with_context() {
|
||||
let payload = "dBgIw8DnNHxJojiXzu445qUC4UpxwZCy";
|
||||
let mut context = tera::Context::default();
|
||||
let node = crate::types::Node::new(Some(payload.to_string()));
|
||||
let node = crate::graph::Node::new(Some(payload.to_string()));
|
||||
let graph = crate::syntax::serial::populate_graph();
|
||||
context.insert("node", &node);
|
||||
context
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue