feat(activitypub): implement user outbox endpoint and federate thoughts to followers

This commit is contained in:
2025-09-06 01:46:11 +02:00
parent e9c4088e68
commit 3dd6c0f64b
10 changed files with 411 additions and 9 deletions

View File

@@ -66,3 +66,11 @@ pub async fn get_followed_ids(db: &DbConn, user_id: i32) -> Result<Vec<i32>, DbE
Ok(followed_users.into_iter().map(|f| f.followed_id).collect())
}
pub async fn get_follower_ids(db: &DbConn, user_id: i32) -> Result<Vec<i32>, DbErr> {
let followers = follow::Entity::find()
.filter(follow::Column::FollowedId.eq(user_id))
.all(db)
.await?;
Ok(followers.into_iter().map(|f| f.follower_id).collect())
}

View File

@@ -36,3 +36,10 @@ pub async fn get_user_by_username(
.one(db)
.await
}
pub async fn get_users_by_ids(db: &DbConn, ids: Vec<i32>) -> Result<Vec<user::Model>, DbErr> {
user::Entity::find()
.filter(user::Column::Id.is_in(ids))
.all(db)
.await
}