Skip to content

Make add and remove endpoints accept workflow ids in addition to crawl ids#3228

Merged
tw4l merged 3 commits intomainfrom
issue-3225-add-workflow-crawls-to-coll
Mar 18, 2026
Merged

Make add and remove endpoints accept workflow ids in addition to crawl ids#3228
tw4l merged 3 commits intomainfrom
issue-3225-add-workflow-crawls-to-coll

Conversation

@tw4l
Copy link
Copy Markdown
Member

@tw4l tw4l commented Mar 17, 2026

Fixes #3225

Modifies the existing collection /add and /remove endpoints to accept a list of workflow ids in addition to crawl ids, and gracefully handles any overlap between the two.

This will allow us to more easily add all of a workflow's crawls to a collection in the frontend.

@tw4l tw4l requested review from emma-sg and ikreymer March 17, 2026 15:04
Comment on lines +1462 to +1464
for config_id in add_remove.crawlconfigIds:
for crawl_id in await colls.crawl_ops.get_config_crawl_ids(config_id):
crawl_ids.add(crawl_id)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason for this to only operate on one config id at a time, rather than a list? This could be a single db call rather than one for each workflow

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No good reason, certainly! Good call :)

@tw4l tw4l force-pushed the issue-3225-add-workflow-crawls-to-coll branch from 216ac7c to 72b59c9 Compare March 18, 2026 13:03
@tw4l tw4l requested a review from emma-sg March 18, 2026 14:05
Copy link
Copy Markdown
Member

@emma-sg emma-sg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left one more note but I think this looks good overall

Comment on lines +1462 to +1465
for crawl_id in await colls.crawl_ops.get_config_crawl_ids(
add_remove.crawlconfigIds
):
crawl_ids.add(crawl_id)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very small nit but I believe this could be reduced to a single update call on the set as well:

Suggested change
for crawl_id in await colls.crawl_ops.get_config_crawl_ids(
add_remove.crawlconfigIds
):
crawl_ids.add(crawl_id)
crawl_ids.update(await colls.crawl_ops.get_config_crawl_ids(
add_remove.crawlconfigIds
))

@tw4l tw4l merged commit 1a1f9f7 into main Mar 18, 2026
24 checks passed
@tw4l tw4l deleted the issue-3225-add-workflow-crawls-to-coll branch March 18, 2026 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Task]: API endpoint to add all crawls from workflow to collection

2 participants