mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-24 16:23:44 -04:00
initial
This commit is contained in:
@@ -51,14 +51,22 @@ from app.utils import (
|
|||||||
|
|
||||||
|
|
||||||
def dao_fetch_all_services(only_active=False):
|
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:
|
if only_active:
|
||||||
query = query.filter(Service.active)
|
stmt = (
|
||||||
|
select(Service)
|
||||||
return query.all()
|
.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):
|
def get_services_by_partial_name(service_name):
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ def _create_service_invite(invited_user, invite_link_host):
|
|||||||
redis_store.set(
|
redis_store.set(
|
||||||
f"email-personalisation-{saved_notification.id}",
|
f"email-personalisation-{saved_notification.id}",
|
||||||
json.dumps(personalisation),
|
json.dumps(personalisation),
|
||||||
ex=2*24*60*60,
|
ex=2 * 24 * 60 * 60,
|
||||||
)
|
)
|
||||||
send_notification_to_queue(saved_notification, queue=QueueNames.NOTIFY)
|
send_notification_to_queue(saved_notification, queue=QueueNames.NOTIFY)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user