old_console/ncircc/services/utils.py
2024-11-02 14:12:45 +03:00

11 lines
446 B
Python

from ncircc.models.notification import Notification
def get_incident_notification_mapper() -> dict:
"""Return mapper with key: value incident_pk: notification_id."""
all_notifications = Notification.objects.select_related('incident').all()
mapper = {}
for notification in all_notifications:
if notification.incident.pk not in mapper:
mapper[str(notification.incident.pk)] = notification.pk
return mapper