diff --git a/src/activitypub/inbox.rs b/src/activitypub/inbox.rs new file mode 100644 index 0000000..612aa6b --- /dev/null +++ b/src/activitypub/inbox.rs @@ -0,0 +1,20 @@ +use axum::{extract::State, http::StatusCode, Json}; +use sea_orm::{EntityTrait, QueryOrder, QuerySelect}; + +use crate::{model, server::Context}; + +use super::JsonLD; + + +pub async fn get(State(ctx) : State, Json(_object): Json) -> Result, StatusCode> { + match model::activity::Entity::find() + .order_by(model::activity::Column::Published, sea_orm::Order::Desc) + .limit(20) + .all(ctx.db()) + .await + { + Ok(x) => todo!(), + Err(_e) => Err(StatusCode::INTERNAL_SERVER_ERROR), + } +} + diff --git a/src/activitypub/mod.rs b/src/activitypub/mod.rs index d572320..f9efe53 100644 --- a/src/activitypub/mod.rs +++ b/src/activitypub/mod.rs @@ -1,4 +1,6 @@ pub mod user; +pub mod inbox; +pub mod outbox; pub mod object; pub mod activity; pub mod well_known; @@ -53,10 +55,3 @@ pub async fn view(State(ctx): State) -> Result, )) } -pub async fn inbox(State(_ctx) : State, Json(_object): Json) -> Result, StatusCode> { - todo!() -} - -pub async fn outbox(State(_db): State) -> Result, StatusCode> { - todo!() -} diff --git a/src/activitypub/outbox.rs b/src/activitypub/outbox.rs new file mode 100644 index 0000000..e69de29 diff --git a/src/migrations/mod.rs b/src/migrations/mod.rs index e4964f1..4bec1c0 100644 --- a/src/migrations/mod.rs +++ b/src/migrations/mod.rs @@ -6,6 +6,7 @@ mod m20240322_000002_add_likes_shares; mod m20240322_000003_add_indexes; mod m20240323_000001_add_user_configs; mod m20240323_000002_add_simple_credentials; +mod m20240324_000001_add_addressing; pub struct Migrator; @@ -19,6 +20,7 @@ impl MigratorTrait for Migrator { Box::new(m20240322_000003_add_indexes::Migration), Box::new(m20240323_000001_add_user_configs::Migration), Box::new(m20240323_000002_add_simple_credentials::Migration), + Box::new(m20240324_000001_add_addressing::Migration), ] } } diff --git a/src/model/mod.rs b/src/model/mod.rs index 5894384..2313225 100644 --- a/src/model/mod.rs +++ b/src/model/mod.rs @@ -4,9 +4,11 @@ pub mod user; pub mod config; pub mod relation; +pub mod addressing; pub mod share; pub mod like; pub mod credential; +pub mod session; pub mod faker;