MicProtocol / apps /api /dist /analytics /analytics.controller.js
Benaah's picture
Upload folder using huggingface_hub
303c85f verified
Raw History Blame Contribute Delete
6.27 kB
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AnalyticsController = void 0;
const common_1 = require("@nestjs/common");
const swagger_1 = require("@nestjs/swagger");
const analytics_service_1 = require("./analytics.service");
const better_auth_guard_1 = require("../auth/better-auth.guard");
const subscription_guard_1 = require("../billing/subscription.guard");
const subscription_features_1 = require("../billing/subscription-features");
let AnalyticsController = class AnalyticsController {
analyticsService;
constructor(analyticsService) {
this.analyticsService = analyticsService;
}
async getDashboardMetrics(podcastId, req) {
return this.analyticsService.getDashboardMetrics(podcastId, req.userId);
}
async getPipeline(podcastId, req) {
return this.analyticsService.getGuestPipeline(podcastId, req.userId);
}
async getOutreachMetrics(podcastId, req) {
return this.analyticsService.getOutreachMetrics(podcastId, req.userId);
}
async getSchedulingMetrics(podcastId, daysBack, req) {
return this.analyticsService.getSchedulingMetrics(podcastId, req.userId, daysBack ? parseInt(daysBack, 10) : 90);
}
async getActivity(podcastId, limit, req) {
return this.analyticsService.getRecentActivity(podcastId, req.userId, limit ? parseInt(limit, 10) : 20);
}
};
exports.AnalyticsController = AnalyticsController;
__decorate([
(0, common_1.Get)("dashboard"),
(0, swagger_1.ApiOperation)({
summary: "Dashboard metrics",
description: "Get key metrics for the podcast dashboard",
}),
(0, swagger_1.ApiParam)({ name: "podcastId", description: "Podcast ID" }),
(0, swagger_1.ApiResponse)({ status: 200, description: "Dashboard metrics retrieved" }),
__param(0, (0, common_1.Param)("podcastId")),
__param(1, (0, common_1.Req)()),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String, Object]),
__metadata("design:returntype", Promise)
], AnalyticsController.prototype, "getDashboardMetrics", null);
__decorate([
(0, common_1.Get)("pipeline"),
(0, swagger_1.ApiOperation)({
summary: "Guest pipeline",
description: "Get guest counts by status with priority scores",
}),
(0, swagger_1.ApiParam)({ name: "podcastId", description: "Podcast ID" }),
__param(0, (0, common_1.Param)("podcastId")),
__param(1, (0, common_1.Req)()),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String, Object]),
__metadata("design:returntype", Promise)
], AnalyticsController.prototype, "getPipeline", null);
__decorate([
(0, common_1.Get)("outreach"),
(0, swagger_1.ApiOperation)({
summary: "Outreach metrics",
description: "Get email sequence performance metrics (Studio plan)",
}),
(0, swagger_1.ApiParam)({ name: "podcastId", description: "Podcast ID" }),
(0, subscription_guard_1.RequireFeature)(subscription_features_1.SubscriptionFeature.ADVANCED_ANALYTICS),
__param(0, (0, common_1.Param)("podcastId")),
__param(1, (0, common_1.Req)()),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String, Object]),
__metadata("design:returntype", Promise)
], AnalyticsController.prototype, "getOutreachMetrics", null);
__decorate([
(0, common_1.Get)("scheduling"),
(0, swagger_1.ApiOperation)({
summary: "Scheduling metrics",
description: "Get episode scheduling and conversion metrics (Studio plan)",
}),
(0, swagger_1.ApiParam)({ name: "podcastId", description: "Podcast ID" }),
(0, swagger_1.ApiQuery)({ name: "daysBack", type: Number, required: false, description: "Days to look back" }),
(0, subscription_guard_1.RequireFeature)(subscription_features_1.SubscriptionFeature.ADVANCED_ANALYTICS),
__param(0, (0, common_1.Param)("podcastId")),
__param(1, (0, common_1.Query)("daysBack")),
__param(2, (0, common_1.Req)()),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String, String, Object]),
__metadata("design:returntype", Promise)
], AnalyticsController.prototype, "getSchedulingMetrics", null);
__decorate([
(0, common_1.Get)("activity"),
(0, swagger_1.ApiOperation)({
summary: "Activity timeline",
description: "Get recent activity for the podcast",
}),
(0, swagger_1.ApiParam)({ name: "podcastId", description: "Podcast ID" }),
(0, swagger_1.ApiQuery)({ name: "limit", type: Number, required: false }),
__param(0, (0, common_1.Param)("podcastId")),
__param(1, (0, common_1.Query)("limit")),
__param(2, (0, common_1.Req)()),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String, String, Object]),
__metadata("design:returntype", Promise)
], AnalyticsController.prototype, "getActivity", null);
exports.AnalyticsController = AnalyticsController = __decorate([
(0, swagger_1.ApiTags)("Analytics"),
(0, swagger_1.ApiBearerAuth)("jwt"),
(0, common_1.UseGuards)(better_auth_guard_1.BetterAuthGuard, subscription_guard_1.SubscriptionGuard),
(0, common_1.Controller)("podcasts/:podcastId/analytics"),
__metadata("design:paramtypes", [analytics_service_1.AnalyticsService])
], AnalyticsController);
//# sourceMappingURL=analytics.controller.js.map