Ghost/ghost/stats-service/lib/stats.js
Fabien "egg" O'Carroll 77819d261a Moved Stats Service from Ghost
The functionality hasn't changed this has just moved the code
and updated the tests to provide better coverage
2022-04-21 13:10:33 +01:00

38 lines
815 B
JavaScript

const MRRService = require('./mrr');
const MembersService = require('./members');
class StatsService {
/**
* @param {object} deps
* @param {MRRService} deps.mrr
* @param {MembersService} deps.members
**/
constructor(deps) {
this.mrr = deps.mrr;
this.members = deps.members;
}
async getMRRHistory() {
return this.mrr.getHistory();
}
async getMemberCountHistory() {
return this.members.getCountHistory();
}
/**
* @param {object} deps
* @param {import('knex').Knex} deps.knex
*
* @returns {StatsService}
**/
static create(deps) {
return new StatsService({
mrr: new MRRService(deps),
members: new MembersService(deps)
});
}
}
module.exports = StatsService;