aboutsummaryrefslogtreecommitdiffstats
path: root/adenosine-pds/src
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2022-12-19 22:19:49 -0800
committerbryan newbold <bnewbold@robocracy.org>2022-12-20 00:29:58 -0800
commit83569230701b17a0c24c1c9bdd197629649d92bc (patch)
tree7802846b38b039bdfdb9a9c7a1cbc33b446af93f /adenosine-pds/src
parent746dd5017b71e9ed2bb8a0d2776dacb2e1353a73 (diff)
downloadadenosine-83569230701b17a0c24c1c9bdd197629649d92bc.tar.gz
adenosine-83569230701b17a0c24c1c9bdd197629649d92bc.zip
update bsky getProfile schema
Diffstat (limited to 'adenosine-pds/src')
-rw-r--r--adenosine-pds/src/bsky.rs7
-rw-r--r--adenosine-pds/src/models.rs20
2 files changed, 27 insertions, 0 deletions
diff --git a/adenosine-pds/src/bsky.rs b/adenosine-pds/src/bsky.rs
index d2ae827..7be72f0 100644
--- a/adenosine-pds/src/bsky.rs
+++ b/adenosine-pds/src/bsky.rs
@@ -104,14 +104,21 @@ pub fn bsky_get_profile(srv: &mut AtpService, did: &Did) -> Result<Profile> {
.conn
.prepare_cached("SELECT COUNT(*) FROM bsky_follow WHERE subject_did = $1")?;
let followers_count: u64 = stmt.query_row(params!(did.to_string()), |row| row.get(0))?;
+ let decl = DeclRef {
+ actorType: "app.bsky.system.actorUser".to_string(),
+ cid: "bafyreid27zk7lbis4zw5fz4podbvbs4fc5ivwji3dmrwa6zggnj4bnd57u".to_string(),
+ };
Ok(Profile {
did: did.to_string(),
handle,
+ creator: did.to_string(),
displayName: display_name,
description,
+ declaration: decl,
followersCount: followers_count,
followsCount: follows_count,
postsCount: post_count,
+ membersCount: 0,
myState: json!({}),
})
}
diff --git a/adenosine-pds/src/models.rs b/adenosine-pds/src/models.rs
index 32f9f71..5bf4329 100644
--- a/adenosine-pds/src/models.rs
+++ b/adenosine-pds/src/models.rs
@@ -118,15 +118,35 @@ pub struct ProfileRecord {
pub description: Option<String>,
}
+// app.bsky.system.actorUser or app.bsky.system.actorScene
+#[allow(non_snake_case)]
+#[derive(Debug, serde::Serialize, serde::Deserialize, Clone, PartialEq, Eq)]
+pub struct Declaration {
+ pub actorType: String,
+}
+
+// actorType: app.bsky.system.actorUser
+// cid: bafyreid27zk7lbis4zw5fz4podbvbs4fc5ivwji3dmrwa6zggnj4bnd57u
+#[allow(non_snake_case)]
+#[derive(Debug, serde::Serialize, serde::Deserialize, Clone, PartialEq, Eq)]
+pub struct DeclRef {
+ pub actorType: String,
+ pub cid: String,
+}
+
#[allow(non_snake_case)]
#[derive(Debug, serde::Serialize, serde::Deserialize, Clone, PartialEq, Eq)]
pub struct Profile {
pub did: String,
+ pub declaration: DeclRef,
pub handle: String,
+ // for simple accounts, 'creator' is just the did
+ pub creator: String,
pub displayName: Option<String>,
pub description: Option<String>,
pub followersCount: u64,
pub followsCount: u64,
+ pub membersCount: u64,
pub postsCount: u64,
pub myState: serde_json::Value,
}