Jun 27 MT-5

This commit is contained in:
2026-06-27 12:56:11 -04:00
parent 668cb645e2
commit 7505e82ab4
6 changed files with 344 additions and 10 deletions
+19
View File
@@ -5,9 +5,13 @@ Lightweight, detached descriptor for the resolved tenant. Populated by the
resolver while a control-plane session is open, then carried on `g.tenant`
for the lifetime of the request. Holds no live ORM object — safe to use after
the control session closes.
MT-5: plan feature flags and quota limits are included so quota.py and
gates.py can read them from g.tenant without a second control-DB round-trip.
"""
from dataclasses import dataclass
from typing import Optional
@dataclass(frozen=True)
@@ -17,3 +21,18 @@ class TenantContext:
name: str
plan_id: int
db_uri: str
# MT-5: plan fields (None = unlimited / not loaded)
plan_code: Optional[str] = None
# Quota limits (None = unlimited)
max_users: Optional[int] = None
max_facilities: Optional[int] = None
max_inspections_month: Optional[int] = None
max_issues_month: Optional[int] = None
# Feature gates
allow_mobile_api: bool = True
allow_scheduled_reports: bool = True
allow_branding: bool = True
allow_custom_domain: bool = True