forked from alemi/upub
fix: don't clear audiences
still quite jank way to do it but at least should work again?
This commit is contained in:
parent
ca59c30e70
commit
5de807b3d9
1 changed files with 7 additions and 7 deletions
|
@ -29,15 +29,15 @@ impl From<FieldError> for axum::http::StatusCode {
|
||||||
#[derive(Clone, Debug, Default, PartialEq, Eq, serde::Serialize, serde::Deserialize, sea_orm::FromJsonQueryResult)]
|
#[derive(Clone, Debug, Default, PartialEq, Eq, serde::Serialize, serde::Deserialize, sea_orm::FromJsonQueryResult)]
|
||||||
pub struct Audience(pub Vec<String>);
|
pub struct Audience(pub Vec<String>);
|
||||||
|
|
||||||
use apb::{Link, Node};
|
impl From<apb::Node<serde_json::Value>> for Audience {
|
||||||
impl<T : Link> From<Node<T>> for Audience {
|
fn from(value: apb::Node<serde_json::Value>) -> Self {
|
||||||
fn from(value: Node<T>) -> Self {
|
use apb::{Base, Link};
|
||||||
Audience(
|
Audience(
|
||||||
match value {
|
match value {
|
||||||
Node::Empty => vec![],
|
apb::Node::Empty => vec![],
|
||||||
Node::Link(l) => vec![l.href().to_string()],
|
apb::Node::Link(l) => vec![l.href().to_string()],
|
||||||
Node::Object(o) => if let Some(id) = o.id() { vec![id.to_string()] } else { vec![] },
|
apb::Node::Object(o) => if let Some(id) = o.id() { vec![id.to_string()] } else { vec![] },
|
||||||
Node::Array(arr) => arr.into_iter().filter_map(|l| Some(l.id()?.to_string())).collect(),
|
apb::Node::Array(arr) => arr.into_iter().map(|l| l.href().to_string()).collect(),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue