summaryrefslogtreecommitdiffstats
path: root/crates/sellershut/src/entity/user.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/sellershut/src/entity/user.rs')
-rw-r--r--crates/sellershut/src/entity/user.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/crates/sellershut/src/entity/user.rs b/crates/sellershut/src/entity/user.rs
index 2d09acc..d58f4eb 100644
--- a/crates/sellershut/src/entity/user.rs
+++ b/crates/sellershut/src/entity/user.rs
@@ -36,6 +36,7 @@ pub struct User {
pub user_type: UserType,
}
+#[derive(Serialize, Debug)]
pub struct DbUser {
pub id: String,
pub description: Option<String>,
@@ -214,6 +215,21 @@ pub struct Person {
image: Option<Url>,
}
+#[derive(Clone, Debug, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct PartialPerson {
+ #[serde(rename = "type")]
+ kind: UserType,
+ preferred_username: String,
+ id: ObjectId<User>,
+}
+
+impl From<Person> for PartialPerson {
+ fn from(value: Person) -> Self {
+ Self{ kind: value.kind, preferred_username: value.preferred_username, id: value.id }
+ }
+}
+
impl Person {
pub fn public_id(&self) -> &str {
&self.public_key.id