This commit is contained in:
@@ -20,6 +20,14 @@ ADMIN_EVENT_FLAGS = {
|
||||
"sto_application_updated": "admin_notify_sto_applications",
|
||||
"sto_approved": "admin_notify_sto_applications",
|
||||
"sto_suspended": "admin_notify_sto_applications",
|
||||
"sto_low_review": "admin_notify_sto_applications",
|
||||
"appointment_created": "admin_notify_sto_applications",
|
||||
"appointment_cancelled": "admin_notify_sto_applications",
|
||||
"work_order_created": "admin_notify_sto_applications",
|
||||
"work_order_completed": "admin_notify_sto_applications",
|
||||
"work_order_rejected_by_owner": "admin_notify_sto_applications",
|
||||
"work_order_correction_requested": "admin_notify_sto_applications",
|
||||
"work_order_correction_resolved": "admin_notify_sto_applications",
|
||||
"security_event": "admin_notify_security_events",
|
||||
"rate_limit_exceeded": "admin_notify_security_events",
|
||||
"upload_blocked": "admin_notify_security_events",
|
||||
@@ -47,6 +55,14 @@ def admin_notification_url(entity_type: str | None = None, entity_id: str | int
|
||||
return f"{base}/admin.html?section=sto-applications&entity_id={entity_id}"
|
||||
if entity_type == "user" and entity_id:
|
||||
return f"{base}/admin.html?section=users&entity_id={entity_id}"
|
||||
if entity_type == "vehicle" and entity_id:
|
||||
return f"{base}/admin.html?section=vehicles&entity_id={entity_id}"
|
||||
if entity_type == "appointment" and entity_id:
|
||||
return f"{base}/admin.html?section=appointments&entity_id={entity_id}"
|
||||
if entity_type == "work_order" and entity_id:
|
||||
return f"{base}/admin.html?section=work-orders&entity_id={entity_id}"
|
||||
if entity_type == "ocr_result" and entity_id:
|
||||
return f"{base}/admin.html?section=data&source=ocr_results&entity_id={entity_id}"
|
||||
return f"{base}/admin.html"
|
||||
|
||||
|
||||
@@ -119,6 +135,9 @@ async def send_admin_telegram_notification(notification: AdminNotification) -> N
|
||||
"text": text,
|
||||
"parse_mode": "HTML",
|
||||
"disable_web_page_preview": True,
|
||||
"reply_markup": {
|
||||
"inline_keyboard": [[{"text": "Открыть в админке", "url": link}]]
|
||||
},
|
||||
},
|
||||
)
|
||||
response.raise_for_status()
|
||||
|
||||
Reference in New Issue
Block a user