mirror of
https://github.com/versia-pub/activitypub.git
synced 2026-03-13 10:59:17 +01:00
feat: basic lysand -> ap fetching api
This commit is contained in:
parent
b1af17c5d2
commit
a840feecb0
7 changed files with 234 additions and 19 deletions
|
|
@ -23,6 +23,7 @@ use serde::{Deserialize, Serialize};
|
|||
use std::fmt::Debug;
|
||||
use tracing::info;
|
||||
use url::Url;
|
||||
use uuid::Uuid;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct DbUser {
|
||||
|
|
@ -135,7 +136,7 @@ impl Object for user::Model {
|
|||
return Ok(user);
|
||||
}
|
||||
let model = user::ActiveModel {
|
||||
id: Set(json.id.to_string()),
|
||||
id: Set(Uuid::now_v7().to_string()),
|
||||
username: Set(json.preferred_username),
|
||||
name: Set(json.name),
|
||||
inbox: Set(json.inbox.to_string()),
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ use sea_orm::{ActiveModelTrait, ColumnTrait, EntityTrait, QueryFilter, Set};
|
|||
use serde::{Deserialize, Serialize};
|
||||
use tracing::info;
|
||||
use url::Url;
|
||||
use uuid::Uuid;
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct DbPost {
|
||||
|
|
@ -119,7 +120,7 @@ impl Object for post::Model {
|
|||
let creator = json.attributed_to.dereference(data).await?;
|
||||
let post: post::ActiveModel = post::ActiveModel {
|
||||
content: Set(json.content.clone()),
|
||||
id: Set(json.id.to_string()),
|
||||
id: Set(Uuid::now_v7().to_string()),
|
||||
creator: Set(creator.id.to_string()),
|
||||
created_at: Set(chrono::Utc::now()), //TODO: make this use the real timestamp
|
||||
content_type: Set("text/plain".to_string()), // TODO: make this use the real content type
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue