fix: added new fields to constructors

This commit is contained in:
əlemi 2024-07-15 14:03:22 +02:00
parent e0f427a2b9
commit 960f7be291
Signed by: alemi
GPG key ID: A4895B84D311642C
5 changed files with 14 additions and 2 deletions

5
Cargo.lock generated
View file

@ -140,7 +140,7 @@ checksum = "d301b3b94cb4b2f23d7917810addbbaff90738e0ca2be692bd027e70d7e0330c"
[[package]]
name = "apb"
version = "0.2.1"
version = "0.2.2"
dependencies = [
"async-trait",
"chrono",
@ -4793,6 +4793,7 @@ dependencies = [
"async-trait",
"base64 0.22.1",
"chrono",
"hmac",
"httpsign",
"jrd",
"nodeinfo",
@ -4804,6 +4805,7 @@ dependencies = [
"serde-inline-default",
"serde_default",
"serde_json",
"sha2",
"sha256",
"thiserror",
"tokio",
@ -4841,6 +4843,7 @@ dependencies = [
"chrono",
"clap",
"futures",
"mdhtml",
"openssl",
"sea-orm",
"serde_json",

View file

@ -21,6 +21,9 @@ pub async fn faker(ctx: upub::Context, count: i64) -> Result<(), sea_orm::DbErr>
followers: None,
followers_count: 0,
statuses_count: count as i32,
fields: vec![],
also_known_as: vec![],
moved_to: None,
icon: Some("https://cdn.alemi.dev/social/circle-square.png".to_string()),
image: Some("https://cdn.alemi.dev/social/someriver-xs.jpg".to_string()),
inbox: None,

View file

@ -34,6 +34,9 @@ pub async fn application(
domain: Set(domain.clone()),
preferred_username: Set(domain.clone()),
actor_type: Set(apb::ActorType::Application),
also_known_as: Set(vec![]),
moved_to: Set(None),
fields: Set(vec![]), // TODO we could put some useful things here actually
private_key: Set(Some(privk)),
public_key: Set(pubk),
following: Set(None),

View file

@ -210,7 +210,7 @@ impl Model {
.set_attachment(apb::Node::array(
self.fields
.into_iter()
.filter_map(|x| serde_json::to_value(&x).ok())
.filter_map(|x| serde_json::to_value(x).ok())
.collect()
))
.set_published(Some(self.published))

View file

@ -35,11 +35,14 @@ impl Administrable for crate::Context {
domain: Set(domain),
summary: Set(summary),
preferred_username: Set(username.clone()),
fields: Set(vec![]),
following: Set(None),
following_count: Set(0),
followers: Set(None),
followers_count: Set(0),
statuses_count: Set(0),
also_known_as: Set(vec![]),
moved_to: Set(None),
icon: Set(avatar_url),
image: Set(banner_url),
inbox: Set(None),