mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-05 02:41:14 -05:00
try by not closing session
This commit is contained in:
@@ -52,20 +52,15 @@ from app.utils import (
|
|||||||
|
|
||||||
def dao_fetch_all_services(only_active=False):
|
def dao_fetch_all_services(only_active=False):
|
||||||
|
|
||||||
stmt = (
|
stmt = select(Service)
|
||||||
select(Service)
|
|
||||||
.order_by(asc(Service.created_at))
|
|
||||||
.options(joinedload(Service.users))
|
|
||||||
)
|
|
||||||
if only_active:
|
if only_active:
|
||||||
stmt = (
|
stmt = stmt.where(Service.active)
|
||||||
select(Service)
|
|
||||||
.where(Service.active is True)
|
stmt = stmt.order_by(asc(Service.created_at)).options(joinedload(Service.users))
|
||||||
.order_by(asc(Service.created_at))
|
|
||||||
.options(joinedload(Service.users))
|
result = db.session.execute(stmt)
|
||||||
)
|
return result.unique().scalars().one()
|
||||||
result = db.session.execute(stmt).unique()
|
|
||||||
return result.scalars().all()
|
|
||||||
|
|
||||||
|
|
||||||
def get_services_by_partial_name(service_name):
|
def get_services_by_partial_name(service_name):
|
||||||
|
|||||||
Reference in New Issue
Block a user