feat(applications): add keyboard flow and export outbox
This commit is contained in:
1 parent
cfeee5a814
commit
27bcc291db
11 files changed
+255
-10
No files matched your search
@@ -12,6 +12,7 @@ from urllib.parse import parse_qs, unquote, urlparse
|
||||
from .belki.api import ApiError, calculate_and_store, inspect_bulk_payload, resolve_identity_payload
|
||||
from .belki.history import CalculationStore
|
||||
from .belki.applications import ApplicationError, ApplicationStore, validate_application
|
||||
from .belki.google_sheets_export import GoogleSheetsExportService
|
||||
from .belki.identity import IdentityDirectory
|
||||
from .belki.image_host import ImageHostClient
|
||||
|
||||
@@ -45,6 +46,11 @@ def application_store() -> ApplicationStore:
|
||||
return _APPLICATION_STORE
|
||||
|
||||
|
||||
def sync_application_exports() -> int:
|
||||
"""No-op until the explicitly disabled Google export is configured."""
|
||||
return GoogleSheetsExportService(application_store()).sync_pending()
|
||||
|
||||
|
||||
_WEB_PROFILE_KEY = "web_user"
|
||||
|
||||
|
||||
@@ -217,6 +223,7 @@ class Handler(BaseHTTPRequestHandler):
|
||||
elif self.path == "/api/applications":
|
||||
application = validate_application(payload)
|
||||
application_id = application_store().create(application=application, actor_id=None, reply_peer_id=None, source="web")
|
||||
sync_application_exports()
|
||||
self._json(201, {"id": application_id, "status": "pending", "message": "Заявка отправлена на рассмотрение."})
|
||||
else:
|
||||
self._json(200, calculate_and_store(payload, actor_id=None, source="web"))
|
||||
@@ -264,6 +271,7 @@ class Handler(BaseHTTPRequestHandler):
|
||||
if application is None:
|
||||
self._json(404, {"error": "Заявка не найдена или уже принята"})
|
||||
return
|
||||
sync_application_exports()
|
||||
self._json(200, {"item": application})
|
||||
|
||||
def log_message(self, format: str, *args: object) -> None:
|
||||
|
||||
Reference in new issue
Block a user