mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-22 06:35:10 +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([
|
||||
this.followingsRepository.findBy({ followerId: me })
|
||||
.then(f => new Map(f.map(it => [it.followeeId, it]))),
|
||||
this.followingsRepository.findBy({ followeeId: me })
|
||||
.then(it => it.map(it => it.followerId)),
|
||||
this.followRequestsRepository.findBy({ followerId: me })
|
||||
.then(it => it.map(it => it.followeeId)),
|
||||
this.followRequestsRepository.findBy({ followeeId: me })
|
||||
.then(it => it.map(it => it.followerId)),
|
||||
this.blockingsRepository.findBy({ blockerId: me })
|
||||
.then(it => it.map(it => it.blockeeId)),
|
||||
this.blockingsRepository.findBy({ blockeeId: me })
|
||||
.then(it => it.map(it => it.blockerId)),
|
||||
this.mutingsRepository.findBy({ muterId: me })
|
||||
.then(it => it.map(it => it.muteeId)),
|
||||
this.renoteMutingsRepository.findBy({ muterId: me })
|
||||
.then(it => it.map(it => it.muteeId)),
|
||||
this.followingsRepository.createQueryBuilder('f')
|
||||
.select('f.followerId')
|
||||
.where('f.followeeId = :me', { me })
|
||||
.getRawMany<{ f_followerId: string }>()
|
||||
.then(it => it.map(it => it.f_followerId)),
|
||||
this.followRequestsRepository.createQueryBuilder('f')
|
||||
.select('f.followeeId')
|
||||
.where('f.followerId = :me', { me })
|
||||
.getRawMany<{ f_followeeId: string }>()
|
||||
.then(it => it.map(it => it.f_followeeId)),
|
||||
this.followRequestsRepository.createQueryBuilder('f')
|
||||
.select('f.followerId')
|
||||
.where('f.followeeId = :me', { me })
|
||||
.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(
|
||||
|
|
Loading…
Reference in a new issue