diff --git a/src/model/mod.rs b/src/model/mod.rs index 279b16d8..cfac749a 100644 --- a/src/model/mod.rs +++ b/src/model/mod.rs @@ -29,15 +29,14 @@ impl From for axum::http::StatusCode { #[derive(Clone, Debug, Default, PartialEq, Eq, serde::Serialize, serde::Deserialize, sea_orm::FromJsonQueryResult)] pub struct Audience(pub Vec); -impl From> for Audience { - fn from(value: apb::Node) -> Self { - use apb::{Base, Link}; +impl From> for Audience { + fn from(value: apb::Node) -> Self { Audience( match value { apb::Node::Empty => vec![], apb::Node::Link(l) => vec![l.href().to_string()], apb::Node::Object(o) => if let Some(id) = o.id() { vec![id.to_string()] } else { vec![] }, - apb::Node::Array(arr) => arr.into_iter().map(|l| l.href().to_string()).collect(), + apb::Node::Array(arr) => arr.into_iter().filter_map(|l| Some(l.id()?.to_string())).collect(), } ) }