Fix regression with saving new workflow due to profileid type error (#1946)

Fixes #1945
This commit is contained in:
Tessa Walsh 2024-07-18 12:35:52 -04:00 committed by GitHub
parent f7a675ea2d
commit 3bf7967754
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 4 deletions

View File

@ -188,9 +188,13 @@ class CrawlConfigOps:
if not self.get_channel_crawler_image(config_in.crawlerChannel):
raise HTTPException(status_code=404, detail="crawler_not_found")
profile_id = None
if isinstance(config_in.profileid, UUID):
profile_id = config_in.profileid
# ensure profile is valid, if provided
if config_in.profileid:
await self.profiles.get_profile(config_in.profileid, org)
if profile_id:
await self.profiles.get_profile(profile_id, org)
now = dt_now()
crawlconfig = CrawlConfig(
@ -212,7 +216,7 @@ class CrawlConfigOps:
maxCrawlSize=config_in.maxCrawlSize,
scale=config_in.scale,
autoAddCollections=config_in.autoAddCollections,
profileid=config_in.profileid,
profileid=profile_id,
crawlerChannel=config_in.crawlerChannel,
crawlFilenameTemplate=config_in.crawlFilenameTemplate,
)

View File

@ -314,7 +314,7 @@ class CrawlConfigIn(BaseModel):
jobType: Optional[JobType] = JobType.CUSTOM
profileid: Optional[UUID] = None
profileid: Union[UUID, EmptyStr, None] = None
crawlerChannel: str = "default"
autoAddCollections: Optional[List[UUID]] = []

View File

@ -32,6 +32,7 @@ def test_crawl_config_usernames(
def test_add_crawl_config(crawler_auth_headers, default_org_id, sample_crawl_data):
# Create crawl config
sample_crawl_data["schedule"] = "0 0 * * *"
sample_crawl_data["profileid"] = ""
r = requests.post(
f"{API_PREFIX}/orgs/{default_org_id}/crawlconfigs/",
headers=crawler_auth_headers,