fix: followers was wrong because full model
This commit is contained in:
parent
3725097749
commit
0ec839f42f
1 changed files with 3 additions and 1 deletions
|
@ -34,9 +34,11 @@ pub async fn page<const OUTGOING: bool>(
|
||||||
let offset = page.offset.unwrap_or(0);
|
let offset = page.offset.unwrap_or(0);
|
||||||
match model::relation::Entity::find()
|
match model::relation::Entity::find()
|
||||||
.filter(Condition::all().add(if OUTGOING { Follower } else { Following }.eq(ctx.uid(id.clone()))))
|
.filter(Condition::all().add(if OUTGOING { Follower } else { Following }.eq(ctx.uid(id.clone()))))
|
||||||
|
.select_only()
|
||||||
.select_column(if OUTGOING { Following } else { Follower })
|
.select_column(if OUTGOING { Following } else { Follower })
|
||||||
.limit(limit)
|
.limit(limit)
|
||||||
.offset(page.offset.unwrap_or(0))
|
.offset(page.offset.unwrap_or(0))
|
||||||
|
.into_tuple::<String>()
|
||||||
.all(ctx.db()).await
|
.all(ctx.db()).await
|
||||||
{
|
{
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
|
@ -49,7 +51,7 @@ pub async fn page<const OUTGOING: bool>(
|
||||||
&url!(ctx, "/users/{id}/{follow___}"),
|
&url!(ctx, "/users/{id}/{follow___}"),
|
||||||
offset,
|
offset,
|
||||||
limit,
|
limit,
|
||||||
following.into_iter().map(|x| Node::link(x.following)).collect()
|
following.into_iter().map(Node::link).collect()
|
||||||
).ld_context()
|
).ld_context()
|
||||||
))
|
))
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue