mirror of
https://github.com/versia-pub/activitypub.git
synced 2025-12-06 14:48:19 +01:00
Add User entity to person.rs
This commit is contained in:
parent
a06414f0bd
commit
4c020229e4
|
|
@ -15,6 +15,7 @@ use activitypub_federation::{
|
|||
use chrono::{prelude, DateTime, Utc};
|
||||
use sea_orm::{ActiveModelTrait, ColumnTrait, EntityTrait, QueryFilter, Set};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use entities::prelude::User;
|
||||
use std::fmt::Debug;
|
||||
use tracing::info;
|
||||
use url::Url;
|
||||
|
|
@ -120,6 +121,12 @@ impl Object for user::Model {
|
|||
json: Self::Kind,
|
||||
_data: &Data<Self::DataType>,
|
||||
) -> Result<Self, Self::Error> {
|
||||
let query = User::find()
|
||||
.filter(user::Column::Id.eq(json.id.inner().as_str()))
|
||||
.one(_data.database_connection.as_ref()).await?;
|
||||
if let Some(user) = query {
|
||||
return Ok(user);
|
||||
}
|
||||
let model = user::ActiveModel {
|
||||
id: Set(json.id.to_string()),
|
||||
username: Set(json.preferred_username),
|
||||
|
|
|
|||
Loading…
Reference in a new issue