mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-03 09:51:11 -05:00
And an endpoint to get uploaded letters for a day
Because we won’t be showing uploaded letters individually on the uploads page any more we need a way of listing them. This should be by printing day, to match how we’re grouping them on the uploads page. The response matches a normal `get_notifications` response so we can reuse the same code in the admin app.
This commit is contained in:
@@ -117,3 +117,23 @@ def dao_get_uploads_by_service_id(service_id, limit_days=None, page=1, page_size
|
||||
).order_by(
|
||||
desc("processing_started"), desc("created_at")
|
||||
).paginate(page=page, per_page=page_size)
|
||||
|
||||
|
||||
def dao_get_uploaded_letters_by_print_date(service_id, letter_print_date, page=1, page_size=50):
|
||||
return db.session.query(
|
||||
Notification,
|
||||
).join(
|
||||
Template, Notification.template_id == Template.id
|
||||
).filter(
|
||||
Notification.service_id == service_id,
|
||||
Notification.notification_type == LETTER_TYPE,
|
||||
Notification.api_key_id.is_(None),
|
||||
Notification.status != NOTIFICATION_CANCELLED,
|
||||
Template.hidden.is_(True),
|
||||
_get_printing_day(Notification.created_at) == letter_print_date.date(),
|
||||
).order_by(
|
||||
desc(Notification.created_at)
|
||||
).paginate(
|
||||
page=page,
|
||||
per_page=page_size,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user