1
0
Fork 0
forked from alemi/upub

chore: split inbox/outbox, added forgotten mods

This commit is contained in:
əlemi 2024-03-24 04:05:09 +01:00
parent 65032ef606
commit 2ac7fa0588
Signed by: alemi
GPG key ID: A4895B84D311642C
5 changed files with 26 additions and 7 deletions

20
src/activitypub/inbox.rs Normal file
View file

@ -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<Context>, Json(_object): Json<serde_json::Value>) -> Result<JsonLD<serde_json::Value>, 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),
}
}

View file

@ -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<Context>) -> Result<Json<serde_json::Value>,
))
}
pub async fn inbox(State(_ctx) : State<Context>, Json(_object): Json<serde_json::Value>) -> Result<JsonLD<serde_json::Value>, StatusCode> {
todo!()
}
pub async fn outbox(State(_db): State<Context>) -> Result<Json<serde_json::Value>, StatusCode> {
todo!()
}

View file

View file

@ -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),
]
}
}

View file

@ -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;