From d7a3c09d22c2897aec85f9b0657662d42845ac77 Mon Sep 17 00:00:00 2001 From: Omer Tuchfeld Date: Tue, 2 Sep 2025 12:42:25 +0200 Subject: [PATCH] Remove nonsensical `user_id` filter When checking whether an existing conversation already exists before persisting user conversation details, the `user_id` filter is unnecessary - the `conversation_id` is already unique, and ownership has already been validated in prior steps. This change removes the redundant `user_id` filter from the query. --- src/app/endpoints/query.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/app/endpoints/query.py b/src/app/endpoints/query.py index 85bd986ef..0a465e55c 100644 --- a/src/app/endpoints/query.py +++ b/src/app/endpoints/query.py @@ -81,9 +81,7 @@ def persist_user_conversation_details( """Associate conversation to user in the database.""" with get_session() as session: existing_conversation = ( - session.query(UserConversation) - .filter_by(id=conversation_id, user_id=user_id) - .first() + session.query(UserConversation).filter_by(id=conversation_id).first() ) if not existing_conversation: