fix: followers querying with full id
This commit is contained in:
parent
d7efbf5131
commit
3725097749
1 changed files with 2 additions and 2 deletions
|
@ -11,7 +11,7 @@ pub async fn get<const OUTGOING: bool>(
|
||||||
) -> Result<JsonLD<serde_json::Value>, StatusCode> {
|
) -> Result<JsonLD<serde_json::Value>, StatusCode> {
|
||||||
let follow___ = if OUTGOING { "following" } else { "followers" };
|
let follow___ = if OUTGOING { "following" } else { "followers" };
|
||||||
let count = model::relation::Entity::find()
|
let count = model::relation::Entity::find()
|
||||||
.filter(Condition::all().add(if OUTGOING { Follower } else { Following }.eq(id.clone())))
|
.filter(Condition::all().add(if OUTGOING { Follower } else { Following }.eq(ctx.uid(id.clone()))))
|
||||||
.count(ctx.db()).await.unwrap_or_else(|e| {
|
.count(ctx.db()).await.unwrap_or_else(|e| {
|
||||||
tracing::error!("failed counting {follow___} for {id}: {e}");
|
tracing::error!("failed counting {follow___} for {id}: {e}");
|
||||||
0
|
0
|
||||||
|
@ -33,7 +33,7 @@ pub async fn page<const OUTGOING: bool>(
|
||||||
let limit = page.batch.unwrap_or(20).min(50);
|
let limit = page.batch.unwrap_or(20).min(50);
|
||||||
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(id.clone())))
|
.filter(Condition::all().add(if OUTGOING { Follower } else { Following }.eq(ctx.uid(id.clone()))))
|
||||||
.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))
|
||||||
|
|
Loading…
Reference in a new issue