🐛 fix(service.py): fix typo in params["filter"] assignment
✨ feat(service.py): add support for filtering by user_created field and limit the results to 100 ✨ feat(service.py): add support for fetching additional fields in the response for better data retrieval
This commit is contained in:
parent
5a8ba5f0db
commit
4e62f02226
1 changed files with 15 additions and 6 deletions
|
|
@ -159,13 +159,22 @@ class StoreService(Service):
|
|||
# check for "public" or "Public"
|
||||
|
||||
if filter_by_user:
|
||||
params["deep"] = json.dumps(
|
||||
{
|
||||
"components": {
|
||||
"_filter": {"user_created": {"token": {"_eq": api_key}}}
|
||||
}
|
||||
}
|
||||
user_data = self._get(
|
||||
f"{self.base_url}/users/me", api_key, params={"fields": "id"}
|
||||
)
|
||||
params["filter"] = json.dumps({"user_created": {"_eq": user_data["id"]}})
|
||||
params["limit"] = 100
|
||||
params["fields"] = [
|
||||
"id",
|
||||
"name",
|
||||
"description",
|
||||
"user_created.first_name",
|
||||
"user_created.id",
|
||||
"is_component",
|
||||
"tags.tags_id.name",
|
||||
"tags.tags_id.id",
|
||||
"count(liked_by)",
|
||||
]
|
||||
else:
|
||||
params["filter"] = params["filter"] = json.dumps(
|
||||
{"status": {"_in": ["public", "Public"]}}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue