History

Disable invite creation when WorkOS is not enabled

Rhys Sullivan committed 9 months ago

Commit ddca61b1 parent ffb327f1 file · +5 −1Browse files

Unified · Split

executor/convex/invites.ts+5−1
@@ -46,12 +46,16 @@ export const create = organizationMutation({ · 45 unmodified lines
4646 expiresInDays: v.optional(v.number()),
4747 },
4848 handler: async (ctx, args) => {
49+ if (!workosEnabled) {
50+ throw new Error("Invites require WorkOS auth to be enabled");
51+ }
52+
4953 const now = Date.now();
5054 const expiresAt = now + (args.expiresInDays ?? 7) * 24 * 60 * 60 * 1000;
5155
5256 const token = `invite_${crypto.randomUUID()}`;
5357 const tokenHash = await sha256Hex(token);
54− const provider = workosEnabled ? "workos" : "local";
58+ const provider = "workos";
5559
5660 const inviteId = await ctx.db.insert("invites", {
5761 organizationId: ctx.organizationId,