From 9d2996dece6bda542acf66c291d37f5c241fd2b5 Mon Sep 17 00:00:00 2001 From: alemi Date: Mon, 15 Jul 2024 21:54:40 +0200 Subject: [PATCH] fix: oops go back must be generic object --- upub/core/src/model/actor.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/upub/core/src/model/actor.rs b/upub/core/src/model/actor.rs index 49283d1..7680040 100644 --- a/upub/core/src/model/actor.rs +++ b/upub/core/src/model/actor.rs @@ -1,6 +1,6 @@ use sea_orm::{entity::prelude::*, QuerySelect, SelectColumns}; -use apb::{ActorMut, ActorType, BaseMut, DocumentMut, EndpointsMut, ObjectMut, PublicKeyMut}; +use apb::{field::OptionalString, ActorMut, ActorType, BaseMut, DocumentMut, EndpointsMut, ObjectMut, PublicKeyMut}; use crate::ext::{JsonVec, TypeName}; @@ -22,11 +22,11 @@ impl TypeName for Field { } } -impl From for Field { - fn from(value: serde_json::Value) -> Self { +impl From for Field { + fn from(value: T) -> Self { Field { - name: value.get("name").and_then(|x| x.as_str()).unwrap_or_default().to_string(), - value: value.get("value").and_then(|x| x.as_str()).unwrap_or_default().to_string(), + name: value.name().str().unwrap_or_default(), + value: value.value().str().unwrap_or_default(), field_type: "PropertyValue".to_string(), // TODO can we try parsing this instead?? verified_at: None, // TODO where does verified_at come from? extend apb maybe }