Skip to content

Commit

Permalink
Add eager loading for user plates in get_user_by_id
Browse files Browse the repository at this point in the history
  • Loading branch information
ahdamin committed Oct 7, 2024
1 parent 34476ff commit 8066632
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion genotype_api/database/crud/read.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ async def get_sample_by_id(self, sample_id: str) -> Sample:
return result.scalars().first()

async def get_user_by_id(self, user_id: int) -> User:
users: Query = self._get_query(User)
users: Query = self._get_query(User).options(selectinload(User.plates))
filter_functions = [UserFilter.BY_ID]
filtered_query = apply_user_filter(
users=users, filter_functions=filter_functions, user_id=user_id
Expand Down

0 comments on commit 8066632

Please sign in to comment.