mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-28 22:43:30 +03:00
77819d261a
The functionality hasn't changed this has just moved the code and updated the tests to provide better coverage
38 lines
815 B
JavaScript
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;
|