allow limiting the number of listings fetched
This commit is contained in:
parent
9b03ab83d2
commit
ff2f141b75
1 changed files with 3 additions and 0 deletions
|
|
@ -25,6 +25,7 @@ class ListingRepository:
|
|||
self,
|
||||
query_parameters: QueryParameters | None = None,
|
||||
only_ids: list[int] | None = None,
|
||||
limit: int | None = None,
|
||||
) -> list[modelListing]:
|
||||
"""
|
||||
Get all listings from the database.
|
||||
|
|
@ -37,6 +38,8 @@ class ListingRepository:
|
|||
if only_ids:
|
||||
query = query.where(RentListing.id.in_(only_ids)) # type: ignore
|
||||
query = self._add_where_from_query_parameters(query, query_parameters)
|
||||
if limit:
|
||||
query = query.limit(limit)
|
||||
|
||||
with Session(self.engine) as session:
|
||||
# query = select(modelListing)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue