UNPKG

@wepublish/api

Version:
64 lines 2.73 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.StatsResolver = void 0; const tslib_1 = require("tslib"); const graphql_1 = require("@nestjs/graphql"); const stats_service_1 = require("./stats.service"); const graphql_2 = require("@nestjs/graphql"); const stats_model_1 = require("./stats.model"); let StatsResolver = exports.StatsResolver = class StatsResolver { constructor(statsService) { this.statsService = statsService; } getStats() { // Return a dummy object; actual data is fetched through ResolveField return {}; } authorsCount(stats) { return tslib_1.__awaiter(this, void 0, void 0, function* () { return this.statsService.getAuthorsCount(); }); } articlesCount(stats) { return tslib_1.__awaiter(this, void 0, void 0, function* () { return this.statsService.getArticlesCount(); }); } firstArticleDate(stats) { return tslib_1.__awaiter(this, void 0, void 0, function* () { return this.statsService.getFirstArticleDate(); }); } }; tslib_1.__decorate([ (0, graphql_1.Query)(() => stats_model_1.Stats, { name: 'stats', nullable: true }), tslib_1.__metadata("design:type", Function), tslib_1.__metadata("design:paramtypes", []), tslib_1.__metadata("design:returntype", void 0) ], StatsResolver.prototype, "getStats", null); tslib_1.__decorate([ (0, graphql_1.ResolveField)(() => Number), tslib_1.__param(0, (0, graphql_1.Parent)()), tslib_1.__metadata("design:type", Function), tslib_1.__metadata("design:paramtypes", [stats_model_1.Stats]), tslib_1.__metadata("design:returntype", Promise) ], StatsResolver.prototype, "authorsCount", null); tslib_1.__decorate([ (0, graphql_1.ResolveField)(() => Number), tslib_1.__param(0, (0, graphql_1.Parent)()), tslib_1.__metadata("design:type", Function), tslib_1.__metadata("design:paramtypes", [stats_model_1.Stats]), tslib_1.__metadata("design:returntype", Promise) ], StatsResolver.prototype, "articlesCount", null); tslib_1.__decorate([ (0, graphql_1.ResolveField)(() => graphql_2.GraphQLISODateTime), tslib_1.__param(0, (0, graphql_1.Parent)()), tslib_1.__metadata("design:type", Function), tslib_1.__metadata("design:paramtypes", [stats_model_1.Stats]), tslib_1.__metadata("design:returntype", Promise) ], StatsResolver.prototype, "firstArticleDate", null); exports.StatsResolver = StatsResolver = tslib_1.__decorate([ (0, graphql_1.Resolver)(() => stats_model_1.Stats), tslib_1.__metadata("design:paramtypes", [stats_service_1.StatsService]) ], StatsResolver); //# sourceMappingURL=stats.resolver.js.map