mirror of
https://github.com/GSA/notifications-api.git
synced 2026-01-29 22:11:52 -05:00
Extra call to explicitly load API keys on service load - avoids extra calls later.
This commit is contained in:
@@ -60,6 +60,19 @@ def dao_fetch_service_by_id(service_id, only_active=False):
|
||||
return query.one()
|
||||
|
||||
|
||||
def dao_fetch_service_by_id_with_api_keys(service_id, only_active=False):
|
||||
query = Service.query.filter_by(
|
||||
id=service_id
|
||||
).options(
|
||||
joinedload('api_keys')
|
||||
)
|
||||
|
||||
if only_active:
|
||||
query = query.filter(Service.active)
|
||||
|
||||
return query.one()
|
||||
|
||||
|
||||
def dao_fetch_all_services_by_user(user_id, only_active=False):
|
||||
query = Service.query.filter(
|
||||
Service.users.any(id=user_id)
|
||||
|
||||
Reference in New Issue
Block a user