#1816 - DatabaseService now uses the send function when responding.

This commit is contained in:
Chris McCarthy
2023-09-08 10:15:26 +01:00
parent 2f744af34e
commit ceac89e778
2 changed files with 17 additions and 5 deletions

View File

@@ -52,7 +52,7 @@ class PacketCapture:
self.logger.addFilter(_JSONFilter())
def read(self) -> List[Dict[Any]]:
def read(self) -> List[Dict[str, Any]]:
"""
Read packet capture logs and return them as a list of dictionaries.

View File

@@ -95,10 +95,22 @@ class DatabaseService(Service):
:param payload: The SQL query to be executed.
:param session_id: The session identifier.
:return: The status code of the SQL execution.
:return: True if the Status Code is 200, otherwise False.
"""
result = self._process_sql(payload)
software_manager: SoftwareManager = self.software_manager
software_manager.send_payload_to_session_manager(payload=result, session_id=session_id)
self.send(payload=result, session_id=session_id)
return result["status_code"] == 200
return payload["status_code"] == 200
def send(self, payload: Any, session_id: str, **kwargs) -> bool:
"""
Send a SQL response back down to the SessionManager.
:param payload: The SQL query results.
:param session_id: The session identifier.
:return: True if the Status Code is 200, otherwise False.
"""
software_manager: SoftwareManager = self.software_manager
software_manager.send_payload_to_session_manager(payload=payload, session_id=session_id)
return payload["status_code"] == 200