Skip to content

Commit c33c9b9

Browse files
authored
fix(api): return all users by default if no filter is provided (#6997)
1 parent eed6eb4 commit c33c9b9

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

.changeset/perfect-dolls-rescue.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
'hive': minor
33
---
44

5-
Increase the amount of organization users returned by default from 100 to 200.
5+
Return all users by default if no `first` value is provided for the `Organization.members` field.

packages/services/api/src/modules/organization/providers/organization-members.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ export class OrganizationMembers {
172172
organization.id,
173173
);
174174

175-
const first = args.first ?? 200;
175+
const first = args.first;
176176
const cursor = args.after ? decodeCreatedAtAndUUIDIdBasedCursor(args.after) : null;
177177

178178
const query = sql`
@@ -199,14 +199,14 @@ export class OrganizationMembers {
199199
"om"."organization_id" DESC
200200
, "om"."user_id" DESC
201201
, "om"."user_id" DESC
202-
LIMIT ${first + 1}
202+
${first ? sql`LIMIT ${first + 1}` : sql``}
203203
`;
204204

205205
const result = await this.pool.any<unknown>(query);
206-
const hasNextPage = result.length > first;
206+
const hasNextPage = first !== null ? result.length > first : false;
207207

208208
const organizationMembers = result
209-
.slice(0, first)
209+
.slice(0, first ?? undefined)
210210
.map(row => RawOrganizationMembershipModel.parse(row));
211211
const mapping = await this.resolveMemberships(organization, organizationMembers);
212212

0 commit comments

Comments
 (0)