mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 15:46:07 -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()
|
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):
|
def dao_fetch_all_services_by_user(user_id, only_active=False):
|
||||||
query = Service.query.filter(
|
query = Service.query.filter(
|
||||||
Service.users.any(id=user_id)
|
Service.users.any(id=user_id)
|
||||||
|
|||||||
Reference in New Issue
Block a user