@@ -616,49 +616,6 @@ async def delete_search(self, user: str, collection_id: str, search_id: str) ->
616616
617617 return await self .db_ops .delete_search (user , collection_id , search_id )
618618
619- async def validate_collections_batch (
620- self , user : str , collections : list [view_models .Collection ]
621- ) -> tuple [bool , str ]:
622- """
623- Validate multiple collections in a single database call.
624-
625- Args:
626- user: User identifier
627- collections: List of collection objects to validate
628-
629- Returns:
630- Tuple of (is_valid, error_message). If valid, error_message is empty.
631- """
632- if not collections :
633- return True , ""
634-
635- # Extract collection IDs and validate they exist
636- collection_ids = []
637- for collection in collections :
638- if not collection .id :
639- return False , "Collection object missing 'id' field"
640- collection_ids .append (collection .id )
641-
642- # Remove duplicates while preserving order
643- unique_collection_ids = list (dict .fromkeys (collection_ids ))
644-
645- try :
646- # Single database call to get all collections
647- db_collections = await self .db_ops .query_collections_by_ids (user , unique_collection_ids )
648-
649- # Create a set of found collection IDs for fast lookup
650- found_collection_ids = {str (col .id ) for col in db_collections }
651-
652- # Check if all requested collections were found
653- for collection_id in unique_collection_ids :
654- if collection_id not in found_collection_ids :
655- return False , f"Collection { collection_id } not found"
656-
657- return True , ""
658-
659- except Exception as e :
660- return False , f"Failed to validate collections: { str (e )} "
661-
662619 async def test_mineru_token (self , token : str ) -> dict :
663620 """Test the MinerU API token."""
664621 async with httpx .AsyncClient () as client :
0 commit comments