Enhance search functionality with pagination and improve eager loading in utils
This commit is contained in:
parent
eb7e446e56
commit
cffdc27724
5 changed files with 56 additions and 46 deletions
6
utils.py
6
utils.py
|
@ -1,4 +1,4 @@
|
|||
from sqlalchemy.orm import joinedload
|
||||
from sqlalchemy.orm import joinedload, selectinload
|
||||
from .models import User, Room, Inventory, WorkLog
|
||||
|
||||
def eager_load_user_relationships(query):
|
||||
|
@ -19,8 +19,8 @@ def eager_load_room_relationships(query):
|
|||
return query.options(
|
||||
joinedload(Room.area),
|
||||
joinedload(Room.room_function),
|
||||
joinedload(Room.inventory),
|
||||
joinedload(Room.users)
|
||||
selectinload(Room.inventory),
|
||||
selectinload(Room.users)
|
||||
)
|
||||
|
||||
def eager_load_worklog_relationships(query):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue