@@ -443,8 +443,8 @@ async def get_data_by_type(self, data_type: str) -> List[BaseDataModel]:
443443 logging .exception (f"Failed to query data by type from Cosmos DB: { e } " )
444444 return []
445445
446- async def get_data_by_type_and_plan_id (
447- self , data_type : str , plan_id : str
446+ async def get_data_by_type_and_session_id (
447+ self , data_type : str , session_id : str
448448 ) -> List [BaseDataModel ]:
449449 """Query the Cosmos DB for documents with the matching data_type, session_id and user_id."""
450450 await self .ensure_initialized ()
@@ -453,11 +453,11 @@ async def get_data_by_type_and_plan_id(
453453
454454 model_class = self .MODEL_CLASS_MAPPING .get (data_type , BaseDataModel )
455455 try :
456- query = "SELECT * FROM c WHERE c.user_id=@user_id AND c.data_type=@data_type AND c.plan_id=@plan_id ORDER BY c._ts ASC"
456+ query = "SELECT * FROM c WHERE c.session_id=@session_id AND c.user_id=@user_id AND c.data_type=@data_type ORDER BY c._ts ASC"
457457 parameters = [
458+ {"name" : "@session_id" , "value" : session_id },
458459 {"name" : "@data_type" , "value" : data_type },
459460 {"name" : "@user_id" , "value" : self .user_id },
460- {"name" : "@plan_id" , "value" : plan_id },
461461 ]
462462 return await self .query_items (query , parameters , model_class )
463463 except Exception as e :
0 commit comments