mirror of
https://github.com/better-auth/better-auth.git
synced 2026-05-26 08:56:40 -05:00
use slug
This commit is contained in:
@@ -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 () => {
|
||||
|
||||
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user