diff --git a/backend/app/api/portfolio.py b/backend/app/api/portfolio.py index 6051df5..83dc238 100644 --- a/backend/app/api/portfolio.py +++ b/backend/app/api/portfolio.py @@ -262,6 +262,36 @@ async def add_portfolio_domain( db: AsyncSession = Depends(get_db), ): """Add a domain to portfolio.""" + from app.models.subscription import Subscription, SubscriptionTier, TIER_CONFIG + + # Check subscription portfolio limit + await db.refresh(current_user, ["subscription"]) + + if current_user.subscription: + portfolio_limit = current_user.subscription.portfolio_limit + else: + portfolio_limit = TIER_CONFIG[SubscriptionTier.SCOUT].get("portfolio_limit", 0) + + # Count current portfolio domains + count_result = await db.execute( + select(func.count(PortfolioDomain.id)).where( + PortfolioDomain.user_id == current_user.id + ) + ) + current_count = count_result.scalar() or 0 + + # Check limit (-1 means unlimited) + if portfolio_limit != -1 and current_count >= portfolio_limit: + if portfolio_limit == 0: + raise HTTPException( + status_code=status.HTTP_403_FORBIDDEN, + detail="Portfolio feature not available on Scout plan. Upgrade to Trader or Tycoon.", + ) + raise HTTPException( + status_code=status.HTTP_403_FORBIDDEN, + detail=f"Portfolio limit reached ({portfolio_limit} domains). Upgrade to add more.", + ) + # Check if domain already exists in user's portfolio existing = await db.execute( select(PortfolioDomain).where( diff --git a/frontend/src/app/pricing/page.tsx b/frontend/src/app/pricing/page.tsx index 1d569d9..d910e46 100644 --- a/frontend/src/app/pricing/page.tsx +++ b/frontend/src/app/pricing/page.tsx @@ -77,9 +77,9 @@ const comparisonFeatures = [ { name: 'Watchlist Domains', scout: '5', trader: '50', tycoon: '500' }, { name: 'Check Frequency', scout: 'Daily', trader: 'Hourly', tycoon: '10 min' }, { name: 'Portfolio Domains', scout: '—', trader: '25', tycoon: 'Unlimited' }, - { name: 'Domain Valuation', scout: '—', trader: '✓', tycoon: '✓' }, + { name: 'Domain Valuation', scout: '—', trader: 'check', tycoon: 'check' }, { name: 'Price History', scout: '—', trader: '90 days', tycoon: 'Unlimited' }, - { name: 'Expiry Tracking', scout: '—', trader: '✓', tycoon: '✓' }, + { name: 'Expiry Tracking', scout: '—', trader: 'check', tycoon: 'check' }, ] const faqs = [ @@ -230,10 +230,7 @@ export default function PricingPage() {