Skip to content

Commit

Permalink
Update - modified list_bases_for_app_id db function
Browse files Browse the repository at this point in the history
  • Loading branch information
aybruhm committed Feb 2, 2024
1 parent a0a42be commit 0372e9e
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions agenta-backend/agenta_backend/services/db_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -576,10 +576,21 @@ async def list_bases_for_app_id(
app_id: str, base_name: Optional[str] = None, **kwargs: dict
) -> List[VariantBaseDB]:
assert app_id is not None, "app_id cannot be None"
query_expressions = VariantBaseDB.app.id == ObjectId(app_id)
if base_name:
query_expressions += query_expressions(VariantBaseDB.base_name == base_name)
bases_db = await VariantBaseDB.find(query_expressions).sort("base_name").to_list()
bases_db = (
await VariantBaseDB.find(
VariantBaseDB.app.id == ObjectId(app_id),
VariantBaseDB.base_name == base_name,
)
.sort("base_name")
.to_list()
)
else:
bases_db = (
await VariantBaseDB.find(VariantBaseDB.app.id == ObjectId(app_id))
.sort("base_name")
.to_list()
)
return bases_db


Expand Down

0 comments on commit 0372e9e

Please sign in to comment.