1
0
Fork 0
forked from alemi/upub

fix: followers was wrong because full model

This commit is contained in:
əlemi 2024-03-28 05:19:13 +01:00
parent 3725097749
commit 0ec839f42f
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -34,9 +34,11 @@ pub async fn page<const OUTGOING: bool>(
let offset = page.offset.unwrap_or(0);
match model::relation::Entity::find()
.filter(Condition::all().add(if OUTGOING { Follower } else { Following }.eq(ctx.uid(id.clone()))))
.select_only()
.select_column(if OUTGOING { Following } else { Follower })
.limit(limit)
.offset(page.offset.unwrap_or(0))
.into_tuple::<String>()
.all(ctx.db()).await
{
Err(e) => {
@ -49,7 +51,7 @@ pub async fn page<const OUTGOING: bool>(
&url!(ctx, "/users/{id}/{follow___}"),
offset,
limit,
following.into_iter().map(|x| Node::link(x.following)).collect()
following.into_iter().map(Node::link).collect()
).ld_context()
))
},