mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-11-15 00:12:20 -05:00
21 lines
691 B
Python
21 lines
691 B
Python
from functools import cached_property
|
|
|
|
from fastapi import APIRouter
|
|
|
|
from mealie.routes._base import BaseAdminController, controller
|
|
from mealie.schema.analytics.analytics import MealieAnalytics
|
|
from mealie.services.analytics.service_analytics import AnalyticsService
|
|
|
|
router = APIRouter(prefix="/analytics", include_in_schema=False) # deprecated - use statistics route instead
|
|
|
|
|
|
@controller(router)
|
|
class AdminAboutController(BaseAdminController):
|
|
@cached_property
|
|
def service(self) -> AnalyticsService:
|
|
return AnalyticsService(self.repos)
|
|
|
|
@router.get("", response_model=MealieAnalytics)
|
|
def get_analytics(self):
|
|
return self.service.calculate_analytics()
|