admin notifications and data explorer backend
This commit is contained in:
@@ -48,6 +48,7 @@ from app.schemas.service_center import (
|
||||
VehicleSearchRequest,
|
||||
VehicleSearchResult,
|
||||
)
|
||||
from app.services.admin_notifications import create_admin_notification
|
||||
from app.services.notifications import notify_platform_moderators
|
||||
from app.services.odometer import validate_odometer_change
|
||||
from app.services.rate_limit import check_rate_limit
|
||||
@@ -147,6 +148,25 @@ async def create_service_center(
|
||||
target_type="service_center",
|
||||
target_id=center.id,
|
||||
)
|
||||
await create_admin_notification(
|
||||
session,
|
||||
event_type="sto_application_created",
|
||||
title="Новая заявка СТО",
|
||||
body="\n".join(
|
||||
item
|
||||
for item in [
|
||||
f"Название: {center.display_name or center.name}",
|
||||
f"Город: {center.city or '-'}",
|
||||
f"Телефон: {center.phone or center.contact_phone or '-'}",
|
||||
f"Документы: {len(center.document_photo_urls or [])}",
|
||||
"Статус: pending",
|
||||
]
|
||||
),
|
||||
entity_type="service_center",
|
||||
entity_id=center.id,
|
||||
idempotency_key=f"sto_application_created:{center.id}",
|
||||
metadata={"city": center.city, "owner_user_id": current_user.id},
|
||||
)
|
||||
await session.commit()
|
||||
await session.refresh(center)
|
||||
await notify_platform_moderators(
|
||||
|
||||
Reference in New Issue
Block a user