mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-07-24 07:39:41 +02:00
* resolve file not found error and add constants * add group stats and storage functionality * generate new types * add statistics and storage cap graphs * fix: add loadFood query param #1103 * refactor to flex view
26 lines
764 B
Python
26 lines
764 B
Python
from mealie.pkgs.stats import fs_stats
|
|
from mealie.schema._mealie import MealieModel
|
|
|
|
|
|
class GroupStatistics(MealieModel):
|
|
total_recipes: int
|
|
total_users: int
|
|
total_categories: int
|
|
total_tags: int
|
|
total_tools: int
|
|
|
|
|
|
class GroupStorage(MealieModel):
|
|
used_storage_bytes: int
|
|
used_storage_str: str
|
|
total_storage_bytes: int
|
|
total_storage_str: str
|
|
|
|
@classmethod
|
|
def bytes(cls, used_storage_bytes: int, total_storage_bytes: int) -> "GroupStorage":
|
|
return cls(
|
|
used_storage_bytes=used_storage_bytes,
|
|
used_storage_str=fs_stats.pretty_size(used_storage_bytes),
|
|
total_storage_bytes=total_storage_bytes,
|
|
total_storage_str=fs_stats.pretty_size(total_storage_bytes),
|
|
)
|