Public Access
1
0

feat: add billing foundation and entitlement enforcement

- add workspace-scoped billing storage, usage tracking, and add-on catalog
- enforce plan entitlements for search and deep research routes
- expand pricing and account UI around billing state, usage, and upgrades
This commit is contained in:
pguerrerox
2026-05-22 17:50:28 +00:00
parent f1a46c79f2
commit 94b8c357b4
21 changed files with 2269 additions and 151 deletions
+3 -6
View File
@@ -1,5 +1,6 @@
import type { Pool, PoolClient } from 'pg';
import type { AccountPageData, AccountWorkspace, AppUser, WorkspaceType, WorkspaceRole } from '../../../shared/types.js';
import { getWorkspaceBillingState } from '../billing/service.js';
type DbClient = Pool | PoolClient;
@@ -152,17 +153,13 @@ export async function buildAccountPageData(db: DbClient, user: AppUser): Promise
}
const summary = await getAccountSummaryForUser(db, user.id);
const billing = await getWorkspaceBillingState(db, workspace.id);
return {
profile: user,
workspace,
summary,
billing: {
status: 'not_configured',
planCode: null,
billingInterval: null,
message: 'Subscription management is being prepared. Plan details, usage tracking, and billing controls will appear here in a future update.',
},
billing,
team: {
canManageMembers: workspace.role === 'owner' || workspace.role === 'admin',
message: 'Workspace member management is coming soon.',