0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-03 23:00:14 -05:00
ghost/core/server/api/canary/stats.js
Fabien 'egg' O'Carroll d94859f2e5
Added /stats/subscriptions API (#14547)
refs https://github.com/TryGhost/Team/issues/1505
refs https://github.com/TryGhost/Team/issues/1466

Exposes an API for historical counts broken down by tier and cadence.

Counts backwards from the current stats like MRR to minimize inaccruate
data due to missing/superfluous events.
2022-04-27 14:53:32 +01:00

32 lines
751 B
JavaScript

const statsService = require('../../services/stats');
module.exports = {
docName: 'stats',
memberCountHistory: {
permissions: {
docName: 'members',
method: 'browse'
},
async query() {
return await statsService.getMemberCountHistory();
}
},
mrr: {
permissions: {
docName: 'members',
method: 'browse'
},
async query() {
return await statsService.getMRRHistory();
}
},
subscriptions: {
permissions: {
docName: 'members',
method: 'browse'
},
async query() {
return await statsService.getSubscriptionCountHistory();
}
}
};