feat: certificates, landing pages, ai tutor, website update, compliance

This commit is contained in:
Rotimi Best
2026-05-18 03:47:22 +01:00
parent c31ad63955
commit ac3a2c14a7
644 changed files with 56050 additions and 5439 deletions
@@ -953,7 +953,24 @@ export const getActiveOrganizationPlan = async (orgId: string) => {
.where(and(eq(schema.organizationPlan.orgId, orgId), eq(schema.organizationPlan.isActive, true)))
.limit(1);
return plan ?? null;
if (plan) return plan;
// Secondary workspaces inherit their primary's plan.
const [org] = await db
.select({ parentOrganizationId: schema.organization.parentOrganizationId })
.from(schema.organization)
.where(eq(schema.organization.id, orgId))
.limit(1);
if (!org?.parentOrganizationId) return null;
const [parentPlan] = await db
.select()
.from(schema.organizationPlan)
.where(and(eq(schema.organizationPlan.orgId, org.parentOrganizationId), eq(schema.organizationPlan.isActive, true)))
.limit(1);
return parentPlan ?? null;
};
/**