Skip to content

Commit

Permalink
revert
Browse files Browse the repository at this point in the history
  • Loading branch information
Kenneth Kehl committed Nov 19, 2024
1 parent 0d44f29 commit 32e73f6
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions app/dao/notifications_dao.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,19 +298,17 @@ def get_notifications_for_service(
if client_reference is not None:
filters.append(Notification.client_reference == client_reference)

query = select(Notification).where(*filters)
query = Notification.query.filter(*filters)
query = _filter_query(query, filter_dict)
if personalisation:
query = query.options(joinedload(Notification.template))

query = query.order_by(desc(Notification.created_at))
results = db.session.execute(query).scalars().all()

page_size = current_app.config["PAGE_SIZE"]
offset = (page - 1) * page_size
paginated_results = results[offset : offset + page_size]
pagination = Pagination(paginated_results, page, page_size, len(results))
return pagination
return query.order_by(desc(Notification.created_at)).paginate(
page=page,
per_page=page_size,
count=count_pages,
error_out=error_out,
)


def _filter_query(query, filter_dict=None):
Expand Down

0 comments on commit 32e73f6

Please sign in to comment.