refactor: establish standalone application boundary

This commit is contained in:
leefer
2026-08-03 21:42:25 +08:00
parent 656f28a96d
commit d6def3af15
322 changed files with 73872 additions and 44656 deletions
+19
View File
@@ -0,0 +1,19 @@
from __future__ import annotations
from datetime import date
from http import HTTPStatus
from urllib.parse import parse_qs
class SentimentRoutesMixin:
def _handle_sentiment_get(self, parsed) -> bool:
if parsed.path == "/api/sentiment/history":
query = parse_qs(parsed.query)
trade_date = query.get("trade_date", [date.today().isoformat()])[0]
try:
limit = int(query.get("limit", ["20"])[0])
self.send_json(self.application_service.sentiment_history(trade_date, limit))
except (TypeError, ValueError) as exc:
self.send_json({"error": str(exc)}, HTTPStatus.BAD_REQUEST)
return True
return False