Skip to content

Commit

Permalink
修正
Browse files Browse the repository at this point in the history
  • Loading branch information
samunohito committed Mar 9, 2024
1 parent 05a5da6 commit 43239e1
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions packages/backend/src/server/api/endpoints/users/relation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
});
}
}

0 comments on commit 43239e1

Please sign in to comment.