🐛 fix(service.py): increase default limit value from 10 to 15 to retrieve more components per page
🐛 fix(service.py): fix duplicate assignment in filter parameter to correctly filter public and Public components
This commit is contained in:
parent
7d4e3e2614
commit
bb05c6cd46
1 changed files with 5 additions and 5 deletions
|
|
@ -123,7 +123,7 @@ class StoreService(Service):
|
||||||
self,
|
self,
|
||||||
api_key: str,
|
api_key: str,
|
||||||
page: int = 1,
|
page: int = 1,
|
||||||
limit: int = 10,
|
limit: int = 15,
|
||||||
fields: Optional[List[str]] = None,
|
fields: Optional[List[str]] = None,
|
||||||
filter_by_user: bool = False,
|
filter_by_user: bool = False,
|
||||||
) -> List[ListComponentResponse]:
|
) -> List[ListComponentResponse]:
|
||||||
|
|
@ -136,9 +136,6 @@ class StoreService(Service):
|
||||||
)
|
)
|
||||||
# Only public components or the ones created by the user
|
# Only public components or the ones created by the user
|
||||||
# check for "public" or "Public"
|
# check for "public" or "Public"
|
||||||
params["filter"] = json.dumps(
|
|
||||||
{"_or": [{"status": {"_eq": "public"}}, {"status": {"_eq": "Public"}}]}
|
|
||||||
)
|
|
||||||
|
|
||||||
if filter_by_user:
|
if filter_by_user:
|
||||||
params["deep"] = json.dumps(
|
params["deep"] = json.dumps(
|
||||||
|
|
@ -149,7 +146,10 @@ class StoreService(Service):
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
params["filter"] = json.dumps({"status": {"_eq": "public"}})
|
params["filter"] = params["filter"] = json.dumps(
|
||||||
|
{"_or": [{"status": {"_eq": "public"}}, {"status": {"_eq": "Public"}}]}
|
||||||
|
)
|
||||||
|
|
||||||
results = self._get(self.components_url, api_key, params)
|
results = self._get(self.components_url, api_key, params)
|
||||||
return [ListComponentResponse(**component) for component in results]
|
return [ListComponentResponse(**component) for component in results]
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue