airship-server
Version:
Airship is a framework for Node.JS & TypeScript that helps you to write big, scalable and maintainable API servers.
36 lines • 1.45 kB
JavaScript
;
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const BaseStatisticsService_1 = require("../domain/BaseStatisticsService");
class StatisticsService extends BaseStatisticsService_1.BaseStatisticsService {
constructor(db) {
super();
this._db = db;
}
getStats(day) {
return __awaiter(this, void 0, void 0, function* () {
let stats = yield this._db.Statistics.findAll({
where: {
day
}
});
if (!stats)
return [];
return stats.map((s) => {
return {
groupId: s.groupId,
hits: s.hits
};
});
});
}
}
exports.default = StatisticsService;
//# sourceMappingURL=StatisticsService.js.map