From fa8a646e80e62c85170b3d7ca5eef1f772a637bf Mon Sep 17 00:00:00 2001 From: Glinte <96855131+Glinte@users.noreply.github.com> Date: Mon, 12 Aug 2024 21:09:53 +0800 Subject: [PATCH] Update validation to use helper function --- bot/utils.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/bot/utils.py b/bot/utils.py index fb0d45a..541b689 100644 --- a/bot/utils.py +++ b/bot/utils.py @@ -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."