@cryptotaxi247 / CoPilot / commits / bf47def2

Add session parameter to get_all_alerts_assigned_to_user function

Taylor committed Feb 14, 2024 at 16:52 UTC bf47def2c2cebc3790abcb423cc747bdf7ab9a26
1 file changed +2 -1
backend/app/connectors/dfir_iris/routes/alerts.py
+2 -1
@@ -116,7 +116,7 @@ async def get_alert_by_id(
116 description="Get all alerts assigned to a user",
117 dependencies=[Security(AuthHandler().require_any_scope("admin", "analyst"))],
118 )
119 -async def get_all_alerts_assigned_to_user(user_id: int) -> AlertsResponse:
119 +async def get_all_alerts_assigned_to_user(user_id: int, session: AsyncSession = Depends(get_db)) -> AlertsResponse:
120 """
121 Fetches all alerts assigned to a specific user.
122
@@ -130,6 +130,7 @@ async def get_all_alerts_assigned_to_user(user_id: int) -> AlertsResponse:
130 alerts = (
131 await get_alerts(
132 request=FilterAlertsRequest(alert_owner_id=user_id, per_page=1000),
133 + session=session,
134 )
135 ).alerts
136 alerts_assigned_to_user = []