mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-27 04:43:09 +02:00
perf(server): Improve following/followers API performance
Related #6813
This commit is contained in:
parent
d7e7848c92
commit
e987a50e9f
2 changed files with 4 additions and 2 deletions
|
@ -76,7 +76,8 @@ export default define(meta, async (ps, me) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const query = makePaginationQuery(Followings.createQueryBuilder('following'), ps.sinceId, ps.untilId)
|
const query = makePaginationQuery(Followings.createQueryBuilder('following'), ps.sinceId, ps.untilId)
|
||||||
.andWhere(`following.followeeId = :userId`, { userId: user.id });
|
.andWhere(`following.followeeId = :userId`, { userId: user.id })
|
||||||
|
.innerJoinAndSelect('following.follower', 'follower');
|
||||||
|
|
||||||
const followings = await query
|
const followings = await query
|
||||||
.take(ps.limit!)
|
.take(ps.limit!)
|
||||||
|
|
|
@ -76,7 +76,8 @@ export default define(meta, async (ps, me) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const query = makePaginationQuery(Followings.createQueryBuilder('following'), ps.sinceId, ps.untilId)
|
const query = makePaginationQuery(Followings.createQueryBuilder('following'), ps.sinceId, ps.untilId)
|
||||||
.andWhere(`following.followerId = :userId`, { userId: user.id });
|
.andWhere(`following.followerId = :userId`, { userId: user.id })
|
||||||
|
.innerJoinAndSelect('following.followee', 'followee');
|
||||||
|
|
||||||
const followings = await query
|
const followings = await query
|
||||||
.take(ps.limit!)
|
.take(ps.limit!)
|
||||||
|
|
Loading…
Reference in a new issue