Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(backend): Allow to create organizations without initial owner #4670

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/sharp-crabs-wave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@clerk/backend': minor
---

Allow creating organizations without an initial owner to facilitate B2B onboarding flows
2 changes: 1 addition & 1 deletion packages/backend/src/api/endpoints/OrganizationApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type CreateParams = {
name: string;
slug?: string;
/* The User id for the user creating the organization. The user will become an administrator for the organization. */
createdBy: string;
createdBy?: string;
maxAllowedMemberships?: number;
} & MetadataParams;

Expand Down
2 changes: 1 addition & 1 deletion packages/backend/src/api/resources/JSON.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ export interface OrganizationJSON extends ClerkResourceJSON {
admin_delete_enabled: boolean;
public_metadata: OrganizationPublicMetadata | null;
private_metadata?: OrganizationPrivateMetadata;
created_by: string;
created_by?: string;
created_at: number;
updated_at: number;
}
Expand Down
4 changes: 2 additions & 2 deletions packages/backend/src/api/resources/Organization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ export class Organization {
readonly slug: string | null,
readonly imageUrl: string,
readonly hasImage: boolean,
readonly createdBy: string,
readonly createdAt: number,
readonly updatedAt: number,
readonly publicMetadata: OrganizationPublicMetadata | null = {},
readonly privateMetadata: OrganizationPrivateMetadata = {},
readonly maxAllowedMemberships: number,
readonly adminDeleteEnabled: boolean,
readonly membersCount?: number,
readonly createdBy?: string,
) {}

static fromJSON(data: OrganizationJSON): Organization {
Expand All @@ -24,14 +24,14 @@ export class Organization {
data.slug,
data.image_url || '',
data.has_image,
data.created_by,
data.created_at,
data.updated_at,
data.public_metadata,
data.private_metadata,
data.max_allowed_memberships,
data.admin_delete_enabled,
data.members_count,
data.created_by,
);
}
}