This commit is contained in:
Kenneth Kehl
2024-10-08 11:46:57 -07:00
parent 37dc59324d
commit 16bb89d62a
2 changed files with 15 additions and 7 deletions

View File

@@ -51,14 +51,22 @@ from app.utils import (
def dao_fetch_all_services(only_active=False):
query = Service.query.order_by(asc(Service.created_at)).options(
joinedload(Service.users)
stmt = (
select(Service)
.order_by(asc(Service.created_at))
.options(joinedload(Service.users))
)
if only_active:
query = query.filter(Service.active)
return query.all()
stmt = (
select(Service)
.where(Service.active is True)
.order_by(asc(Service.created_at))
.options(joinedload(Service.users))
)
if only_active:
stmt = stmt.filter(Service.active)
return db.session.execute(stmt).scalars().all()
def get_services_by_partial_name(service_name):

View File

@@ -86,7 +86,7 @@ def _create_service_invite(invited_user, invite_link_host):
redis_store.set(
f"email-personalisation-{saved_notification.id}",
json.dumps(personalisation),
ex=2*24*60*60,
ex=2 * 24 * 60 * 60,
)
send_notification_to_queue(saved_notification, queue=QueueNames.NOTIFY)