@cryptotaxi247 / CoPilot / commits / 95ca16c7

precommit fixes

Taylor committed Jan 29, 2024 at 12:25 UTC 95ca16c7d67e69d0af52e495528bd4651c5aa139
1 file changed +6 -5
backend/app/connectors/dfir_iris/services/cases.py
+6 -5
@@ -4,8 +4,9 @@ from typing import List
4
5 from dfir_iris_client.case import Case
6 from fastapi import HTTPException
7 -from sqlalchemy.ext.asyncio import AsyncSession
7 from loguru import logger
8 +from sqlalchemy.ext.asyncio import AsyncSession
9 +from sqlalchemy.future import select
10
11 from app.connectors.dfir_iris.schema.cases import CaseOlderThanBody
12 from app.connectors.dfir_iris.schema.cases import CaseResponse
@@ -20,7 +21,7 @@ from app.connectors.dfir_iris.utils.universal import fetch_and_parse_data
21 from app.integrations.alert_creation_settings.models.alert_creation_settings import (
22 AlertCreationSettings,
23 )
23 -from sqlalchemy.future import select
24 +
25
26 async def get_client_and_cases() -> Dict:
27 """
@@ -35,6 +36,7 @@ async def get_client_and_cases() -> Dict:
36 result = await fetch_and_parse_data(dfir_iris_client, case.list_cases)
37 return result
38
39 +
40 async def get_customer_code(session: AsyncSession, client_name: str) -> str:
41 """
42 Retrieves the customer code for a given customer ID.
@@ -48,9 +50,7 @@ async def get_customer_code(session: AsyncSession, client_name: str) -> str:
50 """
51 try:
52 alert_creation_settings = await session.execute(
51 - select(AlertCreationSettings).filter(
52 - AlertCreationSettings.iris_customer_name == client_name
53 - )
53 + select(AlertCreationSettings).filter(AlertCreationSettings.iris_customer_name == client_name),
54 )
55 alert_creation_settings = alert_creation_settings.scalars().first()
56 if alert_creation_settings is None:
@@ -60,6 +60,7 @@ async def get_customer_code(session: AsyncSession, client_name: str) -> str:
60 logger.error(f"Error retrieving customer code for customer ID {client_name}: {e}")
61 return "Customer Not Found"
62
63 +
64 def filter_open_cases(cases: List[Dict]) -> List[Dict]:
65 """
66 Filters out cases that are still open.