ea7fffa3a1
- Add SubscriptionPlan model and subscription_plans table (migration 015) - Add billing cycle/period/allow_overage fields to UserProfile (migration 016) - Add subscription_overage_percent config field (replaces overage_factor) - Rewrite check_upload_allowed: use overage_percent, yearly carry-over, no daily cap - Add seed_default_plans(), _plan_to_dict(), get_year_file_count(), _months_elapsed() - Update get_tier/get_all_tiers to be DB-first with TIER_DEFAULTS fallback - Add TIER_DEFAULTS alias (TIERS kept for backward compat) - New /api/plans/ CRUD endpoints (admin-only except list/get) - New /admin/plans Plan Designer page with Alpine.js UI - Add Plan Designer link to admin navigation in base.html - Remove 'Files per day' row from pricing comparison table - Add billing cycle + period start to admin users edit modal - Seed default plans on startup in lifespan handler - Rewrite docs/SubscriptionTiers.md with full plan/overage/API docs - Fix all tests in test_subscription.py (remove daily cap tests, add overage/carry-over tests) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
19 lines
575 B
Python
19 lines
575 B
Python
"""View route for the admin Plan Designer page."""
|
|
|
|
from fastapi import Request
|
|
from fastapi.responses import HTMLResponse
|
|
from fastapi.routing import APIRouter
|
|
from fastapi.templating import Jinja2Templates
|
|
|
|
from app.auth import require_login
|
|
|
|
router = APIRouter()
|
|
templates = Jinja2Templates(directory="frontend/templates")
|
|
|
|
|
|
@router.get("/admin/plans", response_class=HTMLResponse)
|
|
@require_login
|
|
async def plan_designer(request: Request) -> HTMLResponse:
|
|
"""Admin Plan Designer page."""
|
|
return templates.TemplateResponse("admin_plans.html", {"request": request})
|