This commit is contained in:
Bereket Engida
2025-11-09 23:30:59 -08:00
parent d8aca1ccfc
commit 48bc3bbbe5
2 changed files with 14 additions and 15 deletions

View File

@@ -82,8 +82,8 @@ describe("listMembers", async () => {
organizationSlug: "test-second",
},
});
expect(members.data?.members.length).toBe(11);
expect(members.data?.total).toBe(11);
expect(members.data?.members.length).toBe(1);
expect(members.data?.total).toBe(1);
});
it("should limit the number of members", async () => {

View File

@@ -884,22 +884,21 @@ export const listMembers = <O extends OrganizationOptions>(options: O) =>
let organizationId =
ctx.query?.organizationId || session.session.activeOrganizationId;
const adapter = getOrgAdapter<O>(ctx.context, options);
if (!organizationId) {
if (ctx.query?.organizationSlug) {
const organization = await adapter.findOrganizationBySlug(
ctx.query?.organizationSlug,
);
if (!organization) {
throw new APIError("BAD_REQUEST", {
message: ORGANIZATION_ERROR_CODES.ORGANIZATION_NOT_FOUND,
});
}
organizationId = organization.id;
} else {
if (ctx.query?.organizationSlug) {
const organization = await adapter.findOrganizationBySlug(
ctx.query?.organizationSlug,
);
if (!organization) {
throw new APIError("BAD_REQUEST", {
message: ORGANIZATION_ERROR_CODES.NO_ACTIVE_ORGANIZATION,
message: ORGANIZATION_ERROR_CODES.ORGANIZATION_NOT_FOUND,
});
}
organizationId = organization.id;
}
if (!organizationId) {
throw new APIError("BAD_REQUEST", {
message: ORGANIZATION_ERROR_CODES.NO_ACTIVE_ORGANIZATION,
});
}
const isMember = await adapter.findMemberByOrgId({