fix: top-friends returns usernames not UUIDs
Some checks failed
lint / lint (push) Has been cancelled
test / unit (push) Has been cancelled
test / integration (push) Has been cancelled
lint / lint (pull_request) Failing after 9m40s
test / unit (pull_request) Successful in 16m13s
test / integration (pull_request) Failing after 17m12s
Some checks failed
lint / lint (push) Has been cancelled
test / unit (push) Has been cancelled
test / integration (push) Has been cancelled
lint / lint (pull_request) Failing after 9m40s
test / unit (pull_request) Successful in 16m13s
test / integration (pull_request) Failing after 17m12s
This commit is contained in:
@@ -99,9 +99,6 @@ pub async fn get_top_friends_handler(
|
|||||||
) -> Result<Json<serde_json::Value>, ApiError> {
|
) -> Result<Json<serde_json::Value>, ApiError> {
|
||||||
let user = get_user_by_username(&*s.users, &username).await?;
|
let user = get_user_by_username(&*s.users, &username).await?;
|
||||||
let friends = get_top_friends(&*s.top_friends, &user.id).await?;
|
let friends = get_top_friends(&*s.top_friends, &user.id).await?;
|
||||||
let ids: Vec<Uuid> = friends
|
let usernames: Vec<&str> = friends.iter().map(|(_, u)| u.username.as_str()).collect();
|
||||||
.iter()
|
Ok(Json(serde_json::json!({ "topFriends": usernames })))
|
||||||
.map(|(tf, _)| tf.friend_id.as_uuid())
|
|
||||||
.collect();
|
|
||||||
Ok(Json(serde_json::json!({ "top_friends": ids })))
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user