perf(server): Improve following/followers API performance

Related #6813
This commit is contained in:
syuilo 2021-03-21 10:41:21 +09:00
parent d7e7848c92
commit e987a50e9f
2 changed files with 4 additions and 2 deletions

View file

@ -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!)

View file

@ -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!)