Skip to content

Commit

Permalink
Update validation to use helper function
Browse files Browse the repository at this point in the history
  • Loading branch information
Glinte committed Aug 12, 2024
1 parent 7e237c1 commit fa8a646
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions bot/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,10 +407,7 @@ async def validate_door_types(door_types: list[str]) -> list[str]:
Raises:
ValueError: If any of the door types are invalid.
"""
db = DatabaseManager()
valid_door_types_response = await db.table("types").select("name").eq("build_category", "Door").execute()
valid_door_types_in_db = [door_type["name"] for door_type in valid_door_types_response.data]
invalid_door_types = [dt for dt in door_types if dt not in valid_door_types_in_db]
invalid_door_types = [dt for dt in door_types if dt not in await get_valid_door_types()]
if invalid_door_types:
raise ValueError(
f"Invalid door types. Found {invalid_door_types} which are not one of the door types in the database."
Expand Down

0 comments on commit fa8a646

Please sign in to comment.