feat(data-ana): python graphql federation subgraph with strawberry

- strawberry-graphql[asgi] dependency added

- 13 Federation 2 types: ClassPerformance/StudentWeakness/Dashboards/Mastery/ErrorBook

- 11 Query resolvers delegate to existing analytics/mastery services

- RouterAuthMiddleware validates Router-Authorization header on /graphql

- GraphQL endpoint mounted at /graphql alongside existing REST endpoints
This commit is contained in:
SpecialX
2026-07-15 00:57:02 +08:00
parent 1dcdcf23fd
commit a3f4fd013e
7 changed files with 818 additions and 1 deletions

View File

@@ -84,6 +84,12 @@ class Settings(BaseSettings):
readyz_iam_grpc_timeout_s: float = 2.0
readyz_cdc_lag_threshold: int = 1000 # lag 超过此值判定 not_ready
# GraphQL Federation 2 子图v2.1 M1ADR-036
# Apollo Router 请求子图时必须携带 Router-Authorization Header共享密钥
# 与 TS 服务使用相同的 secret由 Secret 注入)
router_auth_secret: str = "" # 留空则 /graphql 返回 403除非 dev_mode=True
graphql_path: str = "/graphql" # GraphQL 端点路径
# 向后兼容:旧代码引用 settings.port / settings.kafka_group_id
@property
def port(self) -> int: