fix(backend): 不要なUserProfileの取得を修正 (#13812)

* fix(backend): 不要なuserProfileの取得を修正

* fix: pnpm@9.0.6 to pnpm@9.1.0

* Revert "fix: pnpm@9.0.6 to pnpm@9.1.0"

This reverts commit eaf265ec2c.
This commit is contained in:
おさむのひと 2024-05-10 15:32:23 +09:00 committed by GitHub
parent f5d57c02c7
commit b298897bde
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -637,18 +637,17 @@ export class UserEntityService implements OnModuleInit {
} }
const _userIds = _users.map(u => u.id); const _userIds = _users.map(u => u.id);
// -- 特に前提条件のない値群を取得
const profilesMap = await this.userProfilesRepository.findBy({ userId: In(_userIds) })
.then(profiles => new Map(profiles.map(p => [p.userId, p])));
// -- 実行者の有無や指定スキーマの種別によって要否が異なる値群を取得 // -- 実行者の有無や指定スキーマの種別によって要否が異なる値群を取得
let profilesMap: Map<MiUser['id'], MiUserProfile> = new Map();
let userRelations: Map<MiUser['id'], UserRelation> = new Map(); let userRelations: Map<MiUser['id'], UserRelation> = new Map();
let userMemos: Map<MiUser['id'], string | null> = new Map(); let userMemos: Map<MiUser['id'], string | null> = new Map();
let pinNotes: Map<MiUser['id'], MiUserNotePining[]> = new Map(); let pinNotes: Map<MiUser['id'], MiUserNotePining[]> = new Map();
if (options?.schema !== 'UserLite') { if (options?.schema !== 'UserLite') {
profilesMap = await this.userProfilesRepository.findBy({ userId: In(_userIds) })
.then(profiles => new Map(profiles.map(p => [p.userId, p])));
const meId = me ? me.id : null; const meId = me ? me.id : null;
if (meId) { if (meId) {
userMemos = await this.userMemosRepository.findBy({ userId: meId }) userMemos = await this.userMemosRepository.findBy({ userId: meId })