From 1621e3cff3e171f6758fef02f6fd5458c7d1e44c Mon Sep 17 00:00:00 2001 From: Michel Roux Date: Tue, 22 Oct 2024 18:32:41 +0200 Subject: [PATCH] refactor: :construction: rework metrics --- lib/Controller/MetricsController.php | 45 ++++++++++++++++++++++++++++ src/store/subscriptions.ts | 2 +- 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 lib/Controller/MetricsController.php diff --git a/lib/Controller/MetricsController.php b/lib/Controller/MetricsController.php new file mode 100644 index 0000000..40ec199 --- /dev/null +++ b/lib/Controller/MetricsController.php @@ -0,0 +1,45 @@ +podcastMetricsReader->metrics($this->userService->getUserUID()); + + foreach ($subscriptions as $id => $subscription) { + try { + $subscriptions[$id]['data'] = $this->podcastDataReader->getCachedOrFetchPodcastData($subscription->getUrl(), $this->userService->getUserUID()); + } catch (\Exception $e) { + continue; + } + } + + return new JSONResponse($subscriptions); + } +} diff --git a/src/store/subscriptions.ts b/src/store/subscriptions.ts index 37163d4..c08e971 100644 --- a/src/store/subscriptions.ts +++ b/src/store/subscriptions.ts @@ -24,7 +24,7 @@ export const useSubscriptions = defineStore('subscriptions', { } catch {} const metrics = await axios.get( - generateUrl('/apps/gpoddersync/personal_settings/metrics'), + generateUrl('/apps/repod/metrics'), ) this.subs = [...metrics.data.subscriptions]