mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-22 13:05:18 +01:00
fix(backend): UserEntityService.getRelationsの取得処理を軽量化 (#13811)
* fix(backend): UserEntityService.getRelationsの取得処理を軽量化 * rollback
This commit is contained in:
parent
b298897bde
commit
f6af6d9679
1 changed files with 35 additions and 14 deletions
|
@ -249,20 +249,41 @@ export class UserEntityService implements OnModuleInit {
|
||||||
] = await Promise.all([
|
] = await Promise.all([
|
||||||
this.followingsRepository.findBy({ followerId: me })
|
this.followingsRepository.findBy({ followerId: me })
|
||||||
.then(f => new Map(f.map(it => [it.followeeId, it]))),
|
.then(f => new Map(f.map(it => [it.followeeId, it]))),
|
||||||
this.followingsRepository.findBy({ followeeId: me })
|
this.followingsRepository.createQueryBuilder('f')
|
||||||
.then(it => it.map(it => it.followerId)),
|
.select('f.followerId')
|
||||||
this.followRequestsRepository.findBy({ followerId: me })
|
.where('f.followeeId = :me', { me })
|
||||||
.then(it => it.map(it => it.followeeId)),
|
.getRawMany<{ f_followerId: string }>()
|
||||||
this.followRequestsRepository.findBy({ followeeId: me })
|
.then(it => it.map(it => it.f_followerId)),
|
||||||
.then(it => it.map(it => it.followerId)),
|
this.followRequestsRepository.createQueryBuilder('f')
|
||||||
this.blockingsRepository.findBy({ blockerId: me })
|
.select('f.followeeId')
|
||||||
.then(it => it.map(it => it.blockeeId)),
|
.where('f.followerId = :me', { me })
|
||||||
this.blockingsRepository.findBy({ blockeeId: me })
|
.getRawMany<{ f_followeeId: string }>()
|
||||||
.then(it => it.map(it => it.blockerId)),
|
.then(it => it.map(it => it.f_followeeId)),
|
||||||
this.mutingsRepository.findBy({ muterId: me })
|
this.followRequestsRepository.createQueryBuilder('f')
|
||||||
.then(it => it.map(it => it.muteeId)),
|
.select('f.followerId')
|
||||||
this.renoteMutingsRepository.findBy({ muterId: me })
|
.where('f.followeeId = :me', { me })
|
||||||
.then(it => it.map(it => it.muteeId)),
|
.getRawMany<{ f_followerId: string }>()
|
||||||
|
.then(it => it.map(it => it.f_followerId)),
|
||||||
|
this.blockingsRepository.createQueryBuilder('b')
|
||||||
|
.select('b.blockeeId')
|
||||||
|
.where('b.blockerId = :me', { me })
|
||||||
|
.getRawMany<{ b_blockeeId: string }>()
|
||||||
|
.then(it => it.map(it => it.b_blockeeId)),
|
||||||
|
this.blockingsRepository.createQueryBuilder('b')
|
||||||
|
.select('b.blockerId')
|
||||||
|
.where('b.blockeeId = :me', { me })
|
||||||
|
.getRawMany<{ b_blockerId: string }>()
|
||||||
|
.then(it => it.map(it => it.b_blockerId)),
|
||||||
|
this.mutingsRepository.createQueryBuilder('m')
|
||||||
|
.select('m.muteeId')
|
||||||
|
.where('m.muterId = :me', { me })
|
||||||
|
.getRawMany<{ m_muteeId: string }>()
|
||||||
|
.then(it => it.map(it => it.m_muteeId)),
|
||||||
|
this.renoteMutingsRepository.createQueryBuilder('m')
|
||||||
|
.select('m.muteeId')
|
||||||
|
.where('m.muterId = :me', { me })
|
||||||
|
.getRawMany<{ m_muteeId: string }>()
|
||||||
|
.then(it => it.map(it => it.m_muteeId)),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return new Map(
|
return new Map(
|
||||||
|
|
Loading…
Reference in a new issue