Skip to content

Commit b7fab38

Browse files
committed
Validate crawls successful and coll exists before updating crawls
1 parent ac25324 commit b7fab38

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

backend/btrixcloud/basecrawls.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -614,8 +614,6 @@ async def add_to_collection(
614614
self, crawl_ids: List[str], collection_id: UUID, org: Organization
615615
):
616616
"""Add crawls to collection."""
617-
await self.validate_all_crawls_successful(crawl_ids)
618-
619617
await self.crawls.update_many(
620618
{"_id": {"$in": crawl_ids}, "oid": org.id},
621619
{"$addToSet": {"collectionIds": collection_id}},

backend/btrixcloud/colls.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ async def add_crawls_to_collection(
231231
headers: Optional[dict] = None,
232232
) -> CollOut:
233233
"""Add crawls to collection"""
234-
await self.crawl_ops.add_to_collection(crawl_ids, coll_id, org)
234+
await self.crawl_ops.validate_all_crawls_successful(crawl_ids)
235235

236236
modified = dt_now()
237237
result = await self.collections.find_one_and_update(
@@ -242,6 +242,8 @@ async def add_crawls_to_collection(
242242
if not result:
243243
raise HTTPException(status_code=404, detail="collection_not_found")
244244

245+
await self.crawl_ops.add_to_collection(crawl_ids, coll_id, org)
246+
245247
await self.update_collection_counts_and_tags(coll_id)
246248
await self.update_collection_dates(coll_id, org.id)
247249

0 commit comments

Comments
 (0)