mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-12-30 05:47:09 -05:00
feat: admin maintenance and analytics stubs (#1107)
* add tail log viewer routes * add log viewer * add _mealie to ignore directories * add detailed breakdown of storage * generate types * add dialog to view breakdown * cleanup mobile UI * move migrations page * spelling * init analytics page * move route up * add remove temp files function * analytics API client * stub out analytics pages * generate types * stub out analytics routes * update names * ignore types * temporary remove analytics from sidebar
This commit is contained in:
33
mealie/services/analytics/service_analytics.py
Normal file
33
mealie/services/analytics/service_analytics.py
Normal file
@@ -0,0 +1,33 @@
|
||||
import uuid
|
||||
|
||||
from mealie.core.settings.static import APP_VERSION
|
||||
from mealie.repos.repository_factory import AllRepositories
|
||||
from mealie.schema.analytics.analytics import MealieAnalytics
|
||||
from mealie.services._base_service import BaseService
|
||||
|
||||
|
||||
class AnalyticsService(BaseService):
|
||||
def __init__(self, repos: AllRepositories):
|
||||
self.repos = repos
|
||||
super().__init__()
|
||||
|
||||
def _databate_type(self) -> str:
|
||||
return "sqlite" if "sqlite" in self.settings.DB_URL else "postgres" # type: ignore
|
||||
|
||||
def calculate_analytics(self) -> MealieAnalytics:
|
||||
return MealieAnalytics(
|
||||
# Site Wide Analytics
|
||||
installation_id=uuid.uuid4(),
|
||||
version=APP_VERSION,
|
||||
database_type=self._databate_type(),
|
||||
# Optional Configs
|
||||
using_ldap=self.settings.LDAP_ENABLED,
|
||||
using_email=self.settings.SMTP_ENABLE,
|
||||
# Stats
|
||||
api_tokens=0,
|
||||
users=0,
|
||||
groups=0,
|
||||
recipes=0,
|
||||
shopping_lists=0,
|
||||
cookbooks=0,
|
||||
)
|
||||
Reference in New Issue
Block a user