Skip to content
This repository was archived by the owner on Sep 3, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/dispatch/incident/flows.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from datetime import datetime
from typing import Any, List

from dispatch.decorators import timer
from dispatch.conference import service as conference_service
from dispatch.conference.models import ConferenceCreate
from dispatch.conversation import service as conversation_service
Expand Down Expand Up @@ -599,6 +600,7 @@ def set_conversation_bookmarks(incident: Incident, db_session: SessionLocal):
log.exception(e)


@timer
def add_participants_to_conversation(
participant_emails: List[str], incident: Incident, db_session: SessionLocal
):
Expand Down Expand Up @@ -630,6 +632,7 @@ def add_participants_to_conversation(
log.exception(e)


@timer
def add_participant_to_tactical_group(
user_email: str, incident: Incident, db_session: SessionLocal
):
Expand Down
5 changes: 5 additions & 0 deletions src/dispatch/incident/messaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"""
import logging

from dispatch.decorators import timer
from dispatch.config import DISPATCH_UI_URL
from dispatch.conversation.enums import ConversationCommands
from dispatch.database.core import SessionLocal, resolve_attr
Expand Down Expand Up @@ -214,6 +215,7 @@ def send_welcome_email_to_participant(
log.debug(f"Welcome email sent to {participant_email}.")


@timer
def send_incident_welcome_participant_messages(
participant_email: str, incident: Incident, db_session: SessionLocal
):
Expand All @@ -227,6 +229,7 @@ def send_incident_welcome_participant_messages(
log.debug(f"Welcome participant messages sent {participant_email}.")


@timer
def get_suggested_document_items(incident: Incident, db_session: SessionLocal):
"""Create the suggested document item message."""
suggested_documents = get_suggested_documents(db_session, incident)
Expand All @@ -246,6 +249,7 @@ def get_suggested_document_items(incident: Incident, db_session: SessionLocal):
return items


@timer
def send_incident_suggested_reading_messages(
incident: Incident, items: list, participant_email: str, db_session: SessionLocal
):
Expand Down Expand Up @@ -464,6 +468,7 @@ def send_incident_update_notifications(
log.debug("Incident updated notifications sent.")


@timer
def send_incident_participant_announcement_message(
participant_email: str, incident: Incident, db_session: SessionLocal
):
Expand Down
2 changes: 2 additions & 0 deletions src/dispatch/incident/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from typing import List, Optional
from pydantic.error_wrappers import ErrorWrapper, ValidationError

from dispatch.decorators import timer
from dispatch.case import service as case_service
from dispatch.database.core import SessionLocal
from dispatch.event import service as event_service
Expand Down Expand Up @@ -62,6 +63,7 @@ def resolve_and_associate_role(
return email_address, service_id


@timer
def get(*, db_session, incident_id: int) -> Optional[Incident]:
"""Returns an incident based on the given id."""
return db_session.query(Incident).filter(Incident.id == incident_id).first()
Expand Down
3 changes: 3 additions & 0 deletions src/dispatch/participant/flows.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import logging
from typing import TypeVar

from dispatch.decorators import timer
from dispatch.case.models import Case
from dispatch.database.core import SessionLocal, get_table_name_by_class_instance
from dispatch.event import service as event_service
Expand All @@ -21,6 +22,7 @@
Subject = TypeVar("Subject", Case, Incident)


@timer
def add_participant(
user_email: str,
subject: Subject,
Expand Down Expand Up @@ -147,6 +149,7 @@ def inactivate_participant(user_email: str, incident: Incident, db_session: Sess
return True


@timer
def reactivate_participant(
user_email: str, incident: Incident, db_session: SessionLocal, service_id: int = None
):
Expand Down
3 changes: 3 additions & 0 deletions src/dispatch/participant/service.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from typing import List, Optional

from dispatch.decorators import timer
from dispatch.case import service as case_service
from dispatch.incident import service as incident_service
from dispatch.individual import service as individual_service
Expand Down Expand Up @@ -43,6 +44,7 @@ def get_by_case_id_and_role(*, db_session, case_id: int, role: str) -> Optional[
)


@timer
def get_by_incident_id_and_email(
*, db_session, incident_id: int, email: str
) -> Optional[Participant]:
Expand All @@ -67,6 +69,7 @@ def get_by_case_id_and_email(*, db_session, case_id: int, email: str) -> Optiona
)


@timer
def get_by_incident_id_and_service_id(
*, db_session, incident_id: int, service_id: int
) -> Optional[Participant]:
Expand Down