From 4def34ef21ac4a416a3f44183076c2c150ef84a0 Mon Sep 17 00:00:00 2001 From: Hannah Wolfe Date: Tue, 29 Mar 2022 13:59:07 +0100 Subject: [PATCH] Removed unused members/stats endpoints refs: https://github.com/TryGhost/Team/issues/1446 - These endpoints are unused, so they are safe to remove - We're starting to remove as much unused & unnecessary code as possible to try to reduce the codebase and increase test coverage --- core/server/api/canary/members.js | 45 ------------------- .../utils/serializers/output/members.js | 2 - core/server/web/api/canary/admin/routes.js | 2 - 3 files changed, 49 deletions(-) diff --git a/core/server/api/canary/members.js b/core/server/api/canary/members.js index 5bd2960ba5..f50d1e1fd8 100644 --- a/core/server/api/canary/members.js +++ b/core/server/api/canary/members.js @@ -452,51 +452,6 @@ module.exports = { }; } }, - subscriberStats: { - permissions: { - method: 'browse' - }, - async query() { - const statsData = await membersService.api.events.getSubscriptions(); - const totalSubscriptions = (_.last(statsData) && _.last(statsData).subscribed) || 0; - statsData.forEach((d) => { - d.date = moment(d.date).format('YYYY-MM-DD'); - }); - return { - resource: 'subscribers', - total: totalSubscriptions, - data: statsData.map((d) => { - return Object.assign({}, { - date: moment(d.date).format('YYYY-MM-DD'), - value: d.subscribed - }); - }) - }; - } - }, - grossVolumeStats: { - permissions: { - method: 'browse' - }, - async query() { - const volumeData = await membersService.api.events.getVolume(); - const volumeStats = Object.keys(volumeData).map((curr) => { - return { - currency: curr, - data: volumeData[curr].map((d) => { - return Object.assign({}, { - date: moment(d.date).format('YYYY-MM-DD'), - value: d.volume - }); - }) - }; - }); - return { - resource: 'gross-volume', - data: volumeStats - }; - } - }, activityFeed: { options: [ diff --git a/core/server/api/canary/utils/serializers/output/members.js b/core/server/api/canary/utils/serializers/output/members.js index ec8c8dabd5..8a29faf5b3 100644 --- a/core/server/api/canary/utils/serializers/output/members.js +++ b/core/server/api/canary/utils/serializers/output/members.js @@ -20,8 +20,6 @@ module.exports = { importCSV: createSerializer('importCSV', passthrough), memberStats: createSerializer('memberStats', passthrough), mrrStats: createSerializer('mrrStats', passthrough), - subscriberStats: createSerializer('subscriberStats', passthrough), - grossVolumeStats: createSerializer('grossVolumeStats', passthrough), activityFeed: createSerializer('activityFeed', passthrough) }; diff --git a/core/server/web/api/canary/admin/routes.js b/core/server/web/api/canary/admin/routes.js index 047637b37b..3289ac6cf1 100644 --- a/core/server/web/api/canary/admin/routes.js +++ b/core/server/web/api/canary/admin/routes.js @@ -113,8 +113,6 @@ module.exports = function apiRoutes() { router.get('/members/stats/count', mw.authAdminApi, http(api.members.memberStats)); router.get('/members/stats/mrr', mw.authAdminApi, http(api.members.mrrStats)); - router.get('/members/stats/subscribers', mw.authAdminApi, http(api.members.subscriberStats)); - router.get('/members/stats/gross_volume', mw.authAdminApi, http(api.members.grossVolumeStats)); router.get('/members/events', mw.authAdminApi, http(api.members.activityFeed));