Skip to content

Commit

Permalink
Add categories overview api
Browse files Browse the repository at this point in the history
  • Loading branch information
ddxv committed Oct 19, 2023
1 parent 284cff3 commit 4c31faf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
11 changes: 0 additions & 11 deletions backend/api_app/controllers/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,6 @@ def get_string_date_from_days_ago(days: int) -> str:
return mydate_str


def category_overview() -> dict:
cats = get_appstore_categories()
# Make app count strings
cats["android"] = cats["android"].apply(
lambda x: "{:,.0f}".format(x) if x else "N/A"
)
cats["ios"] = cats["ios"].apply(lambda x: "{:,.0f}".format(x) if x else "N/A")
category_dicts = cats.to_dict(orient="records")
return category_dicts


def get_app_overview_dict() -> AppsOverview:
new_apps = query_recent_apps(period="weekly")
trending_apps = query_recent_apps(period="monthly")
Expand Down
12 changes: 12 additions & 0 deletions backend/api_app/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,15 @@ class AppsOverview:
new_google: list[AppDetail]
trending_google: list[AppDetail]
trending_ios: list[AppDetail]


@dataclass
class CategoryDetail:
category: str
installs: int
reviews: int


@dataclass
class CategoriesOverview:
data: list[CategoryDetail]

0 comments on commit 4c31faf

Please sign in to comment.