refactor(db)!: adopt project-routed pooled databases

Reorganize WNDB by responsibility and remove legacy scheme endpoints.\n\nRoute analysis and time-series access through project pools, preserve transactional realtime replacement, and refresh GIS materialized views after writes.\n\nAdd database architecture documentation, live pooling coverage, API contract updates, and executable container verification.\n\nBREAKING CHANGE: legacy scheme APIs and flat app.native.wndb module imports are removed.
This commit is contained in:
2026-08-25 18:35:05 +08:00
parent fdbcc5c033
commit fa188af0b1
181 changed files with 8446 additions and 33546 deletions
+14 -12
View File
@@ -1,5 +1,6 @@
from datetime import datetime
from typing import Literal
from uuid import UUID
from pydantic import BaseModel, Field, field_validator
@@ -23,7 +24,7 @@ class SensorPlacementOptimizeRequest(BaseModel):
max_length=63,
pattern=r"^[^/\\\x00]+$",
)
scheme_name: str = Field(..., min_length=1, max_length=32)
run_name: str = Field(..., min_length=1, max_length=64)
sensor_type: Literal["pressure"]
method: Literal["sensitivity", "kmeans"]
sensor_count: int = Field(..., gt=0, le=200)
@@ -39,27 +40,27 @@ class SensorPlacementOptimizeRequest(BaseModel):
class SensorPlacementUpdateRequest(BaseModel):
expected_sensor_location: list[str] = Field(
expected_sensor_locations: list[str] = Field(
...,
min_length=1,
max_length=200,
)
sensor_location: list[str] = Field(..., min_length=1, max_length=200)
sensor_locations: list[str] = Field(..., min_length=1, max_length=200)
@field_validator("expected_sensor_location", "sensor_location")
@field_validator("expected_sensor_locations", "sensor_locations")
@classmethod
def validate_locations(cls, value: list[str]) -> list[str]:
return _normalize_location_ids(value)
class SensorPlacementExportRequest(BaseModel):
sensor_location: list[str] = Field(..., min_length=1, max_length=200)
sensor_locations: list[str] = Field(..., min_length=1, max_length=200)
adjustment_status: dict[str, AdjustmentStatus] = Field(
default_factory=dict,
max_length=200,
)
@field_validator("sensor_location")
@field_validator("sensor_locations")
@classmethod
def validate_locations(cls, value: list[str]) -> list[str]:
return _normalize_location_ids(value)
@@ -81,12 +82,13 @@ class SensorPointResponse(BaseModel):
class SensorPlacementSchemeResponse(BaseModel):
id: int
scheme_name: str
sensor_number: int
run_id: UUID
name: str
sensor_count: int
min_diameter: int
username: str
create_time: datetime
sensor_location: list[str]
created_by: str
created_at: datetime
status: str
sensor_locations: list[str]
sensor_points: list[SensorPointResponse]
can_edit: bool = False