Revert "refactor(backend): UserEntityService.packMany()の高速化 (#13550)"
This reverts commit 5c1d86b796.
This commit is contained in:
parent
fe116be540
commit
958f94dbc7
3 changed files with 36 additions and 729 deletions
|
|
@ -132,9 +132,11 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private userEntityService: UserEntityService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
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]);
|
||||
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];
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue