Skip to content

Commit

Permalink
draft of new pools service
Browse files Browse the repository at this point in the history
  • Loading branch information
diitaz93 committed Nov 28, 2024
1 parent 27efe66 commit baf33e0
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions cg/services/pools/service.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from cg.server.dto.pools.requests import PoolsRequest
from cg.store.store import Store


class PoolsService:

def __init__(self, store: Store):
self.store = store

def get_pools(self, request: PoolsRequest) -> tuple[list[dict], int]:
"""Get pools based on the provided filters."""
pools, total = self.store.get_pools_to_render(
enquiry=request.enquiry,
limit=request.page_size,
offset=(request.page - 1) * request.page_size,
)
parsed_pools: list[dict] = [pools.to_dict() for pools in pools]
return parsed_pools, total

0 comments on commit baf33e0

Please sign in to comment.