diff --git a/src/domain/roasts.rs b/src/domain/roasts.rs index b2c3557..73a0d5b 100644 --- a/src/domain/roasts.rs +++ b/src/domain/roasts.rs @@ -20,6 +20,7 @@ pub struct Roast { #[derive(Debug, Clone, Serialize, Deserialize)] pub struct RoastWithRoaster { + #[serde(flatten)] pub roast: Roast, pub roaster_name: String, pub roaster_slug: String, diff --git a/tests/cli/roasts_cli.rs b/tests/cli/roasts_cli.rs index 793d129..856f9c1 100644 --- a/tests/cli/roasts_cli.rs +++ b/tests/cli/roasts_cli.rs @@ -141,10 +141,10 @@ fn test_list_roasts_shows_added_roast() { assert!(roasts.is_array()); let roasts_array = roasts.as_array().unwrap(); - // Find our roast in the list (note: list returns RoastWithRoaster which has nested structure) + // Find our roast in the list let found = roasts_array .iter() - .any(|item| item["roast"]["id"].as_i64() == Some(roast_id)); + .any(|item| item["id"].as_i64() == Some(roast_id)); assert!( found, "Should find the added roast in the list. Looking for id={}, found {} roasts",