Split port traffic service and replace deprecated UTC/lifespan APIs.

Keep the public facade stable while moving device CRUD and sample/compare
logic into focused modules, and use naive UTC via timeutil plus FastAPI lifespan.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
oliver 2026-08-02 17:06:46 +08:00
parent 6dc3946bc6
commit a2f91f6ee2
12 changed files with 1171 additions and 1044 deletions

9
netx_api/timeutil.py Normal file
View file

@ -0,0 +1,9 @@
"""Timezone helpers. DB columns store naive UTC; keep values naive for comparisons."""
from __future__ import annotations
from datetime import datetime, timezone
def utcnow_naive() -> datetime:
return datetime.now(timezone.utc).replace(tzinfo=None)