Fix: Replace execute_query_single with execute_query in email router

execute_query_single function does not exist in database module.
All calls should use execute_query instead.
This commit is contained in:
Christian 2025-12-19 07:56:05 +01:00
parent fedcbd816c
commit 15f39f13ce

View File

@ -183,7 +183,7 @@ async def list_emails(
""" """
params.extend([limit, offset]) params.extend([limit, offset])
result = execute_query_single(query, tuple(params)) result = execute_query(query, tuple(params))
return result return result
@ -274,7 +274,7 @@ async def download_attachment(email_id: int, attachment_id: int):
JOIN email_messages e ON e.id = a.email_id JOIN email_messages e ON e.id = a.email_id
WHERE a.id = %s AND a.email_id = %s AND e.deleted_at IS NULL WHERE a.id = %s AND a.email_id = %s AND e.deleted_at IS NULL
""" """
result = execute_query_single(query, (attachment_id, email_id)) result = execute_query(query, (attachment_id, email_id))
if not result: if not result:
raise HTTPException(status_code=404, detail="Attachment not found") raise HTTPException(status_code=404, detail="Attachment not found")
@ -745,7 +745,7 @@ async def create_workflow(workflow: EmailWorkflow):
RETURNING * RETURNING *
""" """
result = execute_query_single(query, ( result = execute_query(query, (
workflow.name, workflow.name,
workflow.description, workflow.description,
workflow.classification_trigger, workflow.classification_trigger,
@ -791,7 +791,7 @@ async def update_workflow(workflow_id: int, workflow: EmailWorkflow):
RETURNING * RETURNING *
""" """
result = execute_query_single(query, ( result = execute_query(query, (
workflow.name, workflow.name,
workflow.description, workflow.description,
workflow.classification_trigger, workflow.classification_trigger,
@ -841,7 +841,7 @@ async def toggle_workflow(workflow_id: int):
WHERE id = %s WHERE id = %s
RETURNING enabled RETURNING enabled
""" """
result = execute_query_single(query, (workflow_id,)) result = execute_query(query, (workflow_id,))
if not result: if not result:
raise HTTPException(status_code=404, detail="Workflow not found") raise HTTPException(status_code=404, detail="Workflow not found")
@ -873,7 +873,7 @@ async def execute_workflows_for_email(email_id: int):
FROM email_messages FROM email_messages
WHERE id = %s AND deleted_at IS NULL WHERE id = %s AND deleted_at IS NULL
""" """
email_data = execute_query_single(query, (email_id,)) email_data = execute_query(query, (email_id,))
if not email_data: if not email_data:
raise HTTPException(status_code=404, detail="Email not found") raise HTTPException(status_code=404, detail="Email not found")