Добавить отметку внесенных отчетов
This commit is contained in:
1 parent
623cf5ad3a
commit
e33de2114a
10 files changed
+76
-4
No files matched your search
+15
@@ -669,6 +669,21 @@ class Handler(BaseHTTPRequestHandler):
|
||||
def do_PATCH(self) -> None: # noqa: N802
|
||||
"""Меняет статус новой заявки через PATCH API."""
|
||||
parsed = urlparse(self.path)
|
||||
entered_prefix = "/api/admin/calculations/"
|
||||
if parsed.path.startswith(entered_prefix) and parsed.path.endswith("/entered"):
|
||||
if not self._admin_authorized(): return
|
||||
try:
|
||||
calculation_id = int(parsed.path[len(entered_prefix):-len("/entered")].strip("/"))
|
||||
payload = self._read_json_body()
|
||||
item = history_store().set_entered(calculation_id, bool(payload.get("entered")))
|
||||
except (ApiError, ValueError) as exc:
|
||||
self._json(400, {"error": str(exc)})
|
||||
return
|
||||
if item is None:
|
||||
self._json(404, {"error": "Запись не найдена"})
|
||||
else:
|
||||
self._json(200, {"item": item})
|
||||
return
|
||||
if parsed.path.startswith("/api/admin/vk/conversations/") or parsed.path.startswith("/api/admin/vk/schedules/"):
|
||||
if not self._admin_authorized(): return
|
||||
try:
|
||||
|
||||
Reference in new issue
Block a user