feat(activitypub): implement user outbox endpoint and federate thoughts to followers
This commit is contained in:
@@ -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())
|
||||
}
|
||||
|
@@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user