From 149939f5f0658e6b8e80e2f13d1531e4dd1f5012 Mon Sep 17 00:00:00 2001 From: hailin Date: Sat, 7 Mar 2026 09:01:21 -0800 Subject: [PATCH] fix: store tenant slug (not UUID) in current_tenant; remove plan trial periods Co-Authored-By: Claude Sonnet 4.6 --- it0-web-admin/src/app/(admin)/layout.tsx | 8 +++++--- .../src/infrastructure/seed/plan-seed.service.ts | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/it0-web-admin/src/app/(admin)/layout.tsx b/it0-web-admin/src/app/(admin)/layout.tsx index da4c0b7..a2ad1c0 100644 --- a/it0-web-admin/src/app/(admin)/layout.tsx +++ b/it0-web-admin/src/app/(admin)/layout.tsx @@ -34,10 +34,12 @@ export default function AdminLayout({ children }: { children: React.ReactNode }) const isPlatformAdmin = Array.isArray(user.roles) && (user.roles.includes('platform_admin') || user.roles.includes('platform_super_admin')); if (!isPlatformAdmin) { - apiClient<{ id: string; name: string; plan: string }>('/api/v1/auth/my-org') + apiClient<{ id: string; slug: string; name: string; plan: string }>('/api/v1/auth/my-org') .then((org) => { - setCurrentTenant({ id: org.id, name: org.name, plan: org.plan as any }); - localStorage.setItem('current_tenant', JSON.stringify({ id: org.id, name: org.name, plan: org.plan })); + // Use slug as the tenant identifier (X-Tenant-Id header must be the slug, not UUID) + const tenantId = org.slug || org.id; + setCurrentTenant({ id: tenantId, name: org.name, plan: org.plan as any }); + localStorage.setItem('current_tenant', JSON.stringify({ id: tenantId, name: org.name, plan: org.plan })); }) .catch(() => { /* ignore — token may be expired */ }); } diff --git a/packages/services/billing-service/src/infrastructure/seed/plan-seed.service.ts b/packages/services/billing-service/src/infrastructure/seed/plan-seed.service.ts index 636c0c7..038e05a 100644 --- a/packages/services/billing-service/src/infrastructure/seed/plan-seed.service.ts +++ b/packages/services/billing-service/src/infrastructure/seed/plan-seed.service.ts @@ -29,7 +29,7 @@ const SEED_PLANS = [ maxUsers: 20, maxStandingOrders: 100, hardLimitPercent: 150, - trialDays: 14, + trialDays: 0, isActive: true, }, { @@ -44,7 +44,7 @@ const SEED_PLANS = [ maxUsers: -1, maxStandingOrders: -1, hardLimitPercent: 0, // no hard limit - trialDays: 14, + trialDays: 0, isActive: true, }, ];