Open-source agentic AI Search Execution Platform. Track AI visibility, find opportunities, and let agents turn signals into prioritized actions and drafted fixes across ChatGPT, Claude, Gemini, Google AI Overviews, Google AI Mode, Perplexity, Grok, and Microsoft Copilot.
TypeScript aeoai-agentai-searchanswer-engine-optimizationbrand-monitoringchatgptclaudecopilotdockergeminigeogoogle-ai-overviewsgrokmcpnextjsopen-sourceperplexityseosupabasetypescript
fix(web): name the profiles→organizations relationship so the plan check reads again
Gökhan Geyik62eb7b765838
diff --git a/web/src/lib/actions/organization.ts b/web/src/lib/actions/organization.tsindex 60d3ea8b8..a171bd039 100644--- a/web/src/lib/actions/organization.ts+++ b/web/src/lib/actions/organization.ts@@ -196,7 +196,7 @@ export async function getMyProfile() {const { data: profile } = await supabase.from('profiles')- .select('*, organizations(*)')+ .select('*, organizations!profiles_organization_id_fkey(*)').eq('id', user.id).single();diff --git a/web/src/lib/subscription-guard.test.ts b/web/src/lib/subscription-guard.test.tsindex ed9180474..9e16ddc73 100644--- a/web/src/lib/subscription-guard.test.ts+++ b/web/src/lib/subscription-guard.test.ts@@ -66,7 +66,7 @@ describe('assertWritable', () => {it('reads the organization with the profile, in one query', async () => {await assertWritable().catch(() => {});expect(reads).toEqual([- 'profiles: organization_id, organizations(subscription_status, stripe_subscription_id)',+ 'profiles: organization_id, organizations!profiles_organization_id_fkey(subscription_status, stripe_subscription_id)',]);});diff --git a/web/src/lib/subscription-guard.ts b/web/src/lib/subscription-guard.tsindex 7d7d0d475..5a7560339 100644--- a/web/src/lib/subscription-guard.ts+++ b/web/src/lib/subscription-guard.ts@@ -78,7 +78,9 @@ export async function assertWritable({// The organization comes with the profile (profiles_organization_id_fkey): one round trip.const { data: profile, error } = await supabase.from('profiles')- .select('organization_id, organizations(subscription_status, stripe_subscription_id)')+ .select(+ 'organization_id, organizations!profiles_organization_id_fkey(subscription_status, stripe_subscription_id)',+ ).eq('id', user.id).maybeSingle();if (error) throw new Error(`Could not read the workspace's plan: ${error.message}`);