summaryrefslogtreecommitdiffstats
path: root/crates
diff options
context:
space:
mode:
authorrtkay123 <dev@kanjala.com>2025-07-22 13:27:05 +0200
committerrtkay123 <dev@kanjala.com>2025-07-22 13:27:05 +0200
commite0c23477bd07c86522df6e972fbdb7a70d647431 (patch)
tree18bca2d802487088f6cdeacb2850ef7bccdb1278 /crates
parent377487e86984441041c23261515bb907fe8a8d06 (diff)
downloadsellershut-e0c23477bd07c86522df6e972fbdb7a70d647431.tar.bz2
sellershut-e0c23477bd07c86522df6e972fbdb7a70d647431.zip
test(integration): followers
Diffstat (limited to 'crates')
-rw-r--r--crates/sellershut/src/entity/user/followers/followers_page.rs0
-rw-r--r--crates/sellershut/src/server/routes/users/followers.rs38
2 files changed, 38 insertions, 0 deletions
diff --git a/crates/sellershut/src/entity/user/followers/followers_page.rs b/crates/sellershut/src/entity/user/followers/followers_page.rs
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/crates/sellershut/src/entity/user/followers/followers_page.rs
diff --git a/crates/sellershut/src/server/routes/users/followers.rs b/crates/sellershut/src/server/routes/users/followers.rs
new file mode 100644
index 0000000..ecc5bf0
--- /dev/null
+++ b/crates/sellershut/src/server/routes/users/followers.rs
@@ -0,0 +1,38 @@
+use activitypub_federation::{
+ axum::json::FederationJson, config::Data, protocol::context::WithContext, traits::Object,
+};
+use axum::{
+ debug_handler,
+ extract::{Path, Query},
+ http::{StatusCode, Uri},
+ response::IntoResponse,
+};
+use serde::Deserialize;
+use tracing::trace;
+
+use crate::{entity::user::followers::Follower, error::AppError, state::AppHandle};
+
+#[derive(Deserialize)]
+pub struct Cursor {
+ pub cursor: Option<String>,
+}
+
+#[debug_handler]
+pub async fn http_get_followers(
+ Path(name): Path<String>,
+ Query(cursor): Query<Cursor>,
+ uri: Uri,
+ data: Data<AppHandle>,
+) -> Result<impl IntoResponse, AppError> {
+ trace!(uri = uri.path(), "getting");
+ let follower = Follower {
+ user_id: uri.path().to_string(),
+ cursor: cursor.cursor,
+ };
+ let json_user = follower.into_json(&data).await?;
+ Ok((
+ StatusCode::OK,
+ FederationJson(WithContext::new_default(json_user)),
+ )
+ .into_response())
+}