SurfSense/surfsense_backend/app/schemas
Vonic 4eb6ed18d6 Epic 5 Complete: Billing, Subscriptions, and Admin Features
Resolve all 5 deferred items from Epic 5 adversarial code review:
- Migration 124: Add CASCADE to subscriptionstatus enum drop (prevent orphaned references)
- Stripe rate limiting: In-memory per-user limiter (20 calls/60s) on verify-checkout-session
- Subscription request cooldown: 24h cooldown before resubmitting rejected requests
- Token reset date: Initialize on first subscription activation
- Checkout URL validation: Confirmed HTTPS-only (Stripe always returns HTTPS)

Implement Story 5.4 (Usage Tracking & Rate Limit Enforcement):
- Page quota pre-check at HTTP upload layer
- Extend UserRead schema with token quota fields
- Frontend 402 error handling in document upload
- Quota indicator in dashboard sidebar

Story 5.5 (Admin Seed & Approval Flow):
- Seed admin user migration with default credentials warning
- Subscription approval/rejection routes with admin guard
- 24h rejection cooldown enforcement

Story 5.6 (Admin-Only Model Config):
- Global model config visible across all search spaces
- Per-search-space model configs with user access control
- Superuser CRUD for global configs

Additional fixes from code review:
- PageLimitService: PAST_DUE subscriptions enforce free-tier limits
- TokenQuotaService: PAST_DUE subscriptions enforce free-tier limits
- Config routes: Fixed user_id.is_(None) filter on mutation endpoints
- Stripe webhook: Added guard against silent plan downgrade on unrecognized price_id

All changes formatted with Ruff (Python) and Biome (TypeScript).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-15 03:54:45 +07:00
..
__init__.py Add VisionLLMConfig Pydantic schemas 2026-04-07 18:52:37 +02:00
airtable_auth_credentials.py update airtable indexer 2025-08-26 19:17:46 +02:00
atlassian_auth_credentials.py chore: ran both frontend and backend linting 2026-01-06 15:49:31 +05:30
auth.py Switch refresh token storage from cookies to localStorage 2026-02-05 17:55:21 +02:00
base.py Fixed all ruff lint and formatting errors 2025-07-24 14:43:48 -07:00
chat_comments.py feat: perf optimizations 2026-02-27 17:19:25 -08:00
chat_session_state.py Add chat session state schemas 2026-01-20 16:24:37 +02:00
chunks.py Fixed all ruff lint and formatting errors 2025-07-24 14:43:48 -07:00
clickup_auth_credentials.py feat: implement ClickUp OAuth integration and connector support 2026-01-07 15:15:25 +05:30
discord_auth_credentials.py chore: ran both frontend and backend linting 2026-01-06 15:49:31 +05:30
documents.py refactor: streamline document upload limits and enhance handling of mentioned documents 2026-04-02 19:39:10 -07:00
folders.py chore: ran linting 2026-04-03 13:14:40 +05:30
google_drive.py feat: enhance Google Drive indexing with new options 2026-01-17 12:33:57 +05:30
image_generation.py Epic 5 Complete: Billing, Subscriptions, and Admin Features 2026-04-15 03:54:45 +07:00
incentive_tasks.py feat: added incentive credits system 2026-01-26 23:32:30 -08:00
linear_auth_credentials.py feat: implement auto-refresh capability for Linear and Notion connectors similar to google oauth based ones 2026-01-03 04:24:00 +05:30
logs.py Fixed all ruff lint and formatting errors 2025-07-24 14:43:48 -07:00
new_chat.py feat(story-3.5): add cloud-mode LLM model selection with token quota enforcement 2026-04-14 17:01:21 +07:00
new_llm_config.py Epic 5 Complete: Billing, Subscriptions, and Admin Features 2026-04-15 03:54:45 +07:00
notion_auth_credentials.py feat: implement auto-refresh capability for Linear and Notion connectors similar to google oauth based ones 2026-01-03 04:24:00 +05:30
obsidian_auth_credentials.py Add support for obsidian to surfsense 2026-01-21 15:21:06 -08:00
onedrive_auth_credentials.py feat: implement Microsoft OneDrive connector with OAuth support and indexing capabilities 2026-03-28 14:31:25 +05:30
podcasts.py feat: added configable summary calculation and various improvements 2026-02-26 18:24:57 -08:00
prompts.py Simplify prompts to seed-based CRUD with version tracking 2026-03-31 18:05:42 +02:00
rbac_schemas.py feat: add last_login column to user table and update user login tracking 2026-03-08 18:24:29 +05:30
reports.py feat: add report content update endpoint and integrate Platejs editor for markdown editing 2026-02-16 00:11:34 +05:30
search_source_connector.py Make Vision LLM opt-in for uploads and connectors 2026-04-10 16:45:51 +02:00
search_space.py feat: add shared_memory_md field and enforce character limit in search space updates 2026-04-08 23:37:23 +05:30
slack_auth_credentials.py refactor: improve error handling for Slack token refresh logic 2026-01-04 02:47:50 +05:30
stripe.py Epic 5 Complete: Billing, Subscriptions, and Admin Features 2026-04-15 03:54:45 +07:00
surfsense_docs.py Add SurfSense docs to documents table 2026-01-13 01:15:33 +02:00
teams_auth_credentials.py Add teams connector similar to slack 2026-01-07 15:15:49 -08:00
users.py Epic 5 Complete: Billing, Subscriptions, and Admin Features 2026-04-15 03:54:45 +07:00
video_presentations.py feat: init video presentation agent 2026-03-21 22:13:41 -07:00
vision_llm.py Epic 5 Complete: Billing, Subscriptions, and Admin Features 2026-04-15 03:54:45 +07:00