refactor(backend): UserEntityService.packMany()の高速化 (#13550)
* refactor(backend): UserEntityService.packMany()の高速化 * 修正
This commit is contained in:
parent
6d9c234cb6
commit
5c1d86b796
3 changed files with 729 additions and 36 deletions
|
@ -132,11 +132,9 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private userEntityService: UserEntityService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const ids = Array.isArray(ps.userId) ? ps.userId : [ps.userId];
|
||||
|
||||
const relations = await Promise.all(ids.map(id => this.userEntityService.getRelation(me.id, id)));
|
||||
|
||||
return Array.isArray(ps.userId) ? relations : relations[0];
|
||||
return Array.isArray(ps.userId)
|
||||
? await this.userEntityService.getRelations(me.id, ps.userId).then(it => [...it.values()])
|
||||
: await this.userEntityService.getRelation(me.id, ps.userId).then(it => [it]);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue