Added initial member events timeline API (#12661)

refs https://github.com/TryGhost/Ghost/issues/12633

Allows us to show a list of recent member events for the site dashboard
This commit is contained in:
Fabien 'egg' O'Carroll 2021-02-18 11:52:18 +00:00 committed by GitHub
parent 9c0ecd7214
commit 7abc6ac705
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 1 deletions

View File

@ -475,5 +475,17 @@ module.exports = {
}); });
return volumeStats; return volumeStats;
} }
},
activityFeed: {
permissions: {
method: 'browse'
},
async query() {
const events = await membersService.api.events.getEventTimeline();
return {
events
};
}
} }
}; };

View File

@ -18,7 +18,8 @@ module.exports = {
memberStats: createSerializer('memberStats', passthrough), memberStats: createSerializer('memberStats', passthrough),
mrrStats: createSerializer('mrrStats', passthrough), mrrStats: createSerializer('mrrStats', passthrough),
subscriberStats: createSerializer('subscriberStats', passthrough), subscriberStats: createSerializer('subscriberStats', passthrough),
grossVolumeStats: createSerializer('grossVolumeStats', passthrough) grossVolumeStats: createSerializer('grossVolumeStats', passthrough),
activityFeed: createSerializer('activityFeed', passthrough)
}; };
/** /**

View File

@ -97,6 +97,8 @@ module.exports = function apiRoutes() {
router.get('/members/stats/gross_volume', mw.authAdminApi, http(apiCanary.members.grossVolumeStats)); router.get('/members/stats/gross_volume', mw.authAdminApi, http(apiCanary.members.grossVolumeStats));
router.get('/members/stats', mw.authAdminApi, http(apiCanary.members.stats)); router.get('/members/stats', mw.authAdminApi, http(apiCanary.members.stats));
router.get('/members/events', mw.authAdminApi, http(apiCanary.members.activityFeed));
router.get('/members/upload', mw.authAdminApi, http(apiCanary.members.exportCSV)); router.get('/members/upload', mw.authAdminApi, http(apiCanary.members.exportCSV));
router.post('/members/upload', router.post('/members/upload',
mw.authAdminApi, mw.authAdminApi,