mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 23:55:58 -05:00
Method to return scheduled notifications that are ready to send
This commit is contained in:
@@ -27,7 +27,7 @@ from app.models import (
|
||||
NOTIFICATION_PERMANENT_FAILURE,
|
||||
KEY_TYPE_NORMAL, KEY_TYPE_TEST,
|
||||
LETTER_TYPE,
|
||||
NOTIFICATION_SENT)
|
||||
NOTIFICATION_SENT, ScheduledNotification)
|
||||
|
||||
from app.dao.dao_utils import transactional
|
||||
from app.statsd_decorators import statsd
|
||||
@@ -469,3 +469,9 @@ def dao_get_notifications_by_to_field(service_id, search_term):
|
||||
def dao_created_scheduled_notification(scheduled_notification):
|
||||
db.session.add(scheduled_notification)
|
||||
db.session.commit()
|
||||
|
||||
|
||||
@statsd(namespace="dao")
|
||||
def dao_get_scheduled_notifications():
|
||||
scheduled_notifications = ScheduledNotification.query.filter(ScheduledNotification.scheduled_for < datetime.utcnow()).all()
|
||||
return scheduled_notifications
|
||||
|
||||
Reference in New Issue
Block a user