fix first paginate method

This commit is contained in:
Kenneth Kehl
2024-10-18 08:45:31 -07:00
parent fdc494e561
commit 78aab59d15

View File

@@ -52,11 +52,17 @@ def dao_get_paginated_inbound_sms_for_service_for_public_api(
)
filters.append(InboundSms.created_at < older_than_created_at)
query = InboundSms.query.filter(*filters)
return (
query.order_by(desc(InboundSms.created_at)).paginate(per_page=page_size).items
# As part of the move to sqlalchemy 2.0, we do this manual pagination
# 1.4 had a paginate() method which assumed 'page' was 1 if it was not specified,
# so we set page to 1 here to mimic that.
page = 1
query = db.session.query(InboundSms).filter(*filters)
paginated_items = (
query.order_by(desc(InboundSms.created_at))
.offset((page - 1) * page_size)
.limit(page_size)
)
return paginated_items
def dao_count_inbound_sms_for_service(service_id, limit_days):