Rename Node's body field to "text"

This commit is contained in:
Juno Takano 2025-12-10 10:25:32 -03:00
commit 32ea0f93c3
5 changed files with 23 additions and 22 deletions

View file

@ -97,7 +97,7 @@ async fn node_view(Path(id): Path<String>) -> impl IntoResponse {
context.insert("id", &id);
context.insert("title", &node.title);
context.insert("body", &node.body);
context.insert("text", &node.text);
context.insert("connections", &node.connections.clone());
context.insert("incoming", &graph.incoming.get(&id));
@ -107,12 +107,12 @@ async fn node_view(Path(id): Path<String>) -> impl IntoResponse {
500,
&format!(
r#"Failed to generate page for node {} (ID {}) with {} outgoing,
{} incoming connections and body "{}""#,
{} incoming connections and text "{}""#,
node.title,
id,
node.connections.iter().len(),
graph.incoming.get(&id).iter().len(),
node.body,
node.text,
),
)
}

View file

@ -11,7 +11,7 @@ pub struct Graph {
#[derive(Serialize, Deserialize, Clone, Default, Debug)]
pub struct Node {
pub body: String,
pub text: String,
#[serde(default)] pub title: String,
#[serde(default)] pub links: Vec<String>,
#[serde(default)] pub id: String,
@ -52,7 +52,7 @@ impl Node {
Self {
id: "VoidNode".to_string(),
title: "Pure Void".to_string(),
body: match message {
text: match message {
Some(s) => s,
None => "Node is empty, missing or wasn't found.".to_string()
},