feat(reports): partner and platform analytics
Partner reports — health cohorts, revenue-by-plan, top customers, signup/churn cohorts, plus saved custom reports (create/list/delete). Operator platform-wide reports (MRR, revenue by plan, top tenants, growth). Replaces the reports fixtures in both apps.
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import { Controller, Get, UseGuards } from '@nestjs/common'
|
||||
import { JwtAuthGuard } from '../auth/jwt-auth.guard.js'
|
||||
import { OperatorGuard } from '../auth/operator.guard.js'
|
||||
import { UsersService } from './users.service.js'
|
||||
|
||||
// Platform-wide analytics for the operator reports page. Operator-only.
|
||||
@Controller('reports')
|
||||
@UseGuards(JwtAuthGuard, OperatorGuard)
|
||||
export class PlatformReportsController {
|
||||
constructor(private readonly users: UsersService) {}
|
||||
|
||||
@Get('platform')
|
||||
async platform() {
|
||||
return this.users.platformReports()
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import { Subscription, SubscriptionSchema } from '../schemas/subscription.schema
|
||||
import { Tenant, TenantSchema } from '../schemas/tenant.schema.js'
|
||||
import { User, UserSchema } from '../schemas/user.schema.js'
|
||||
import { TenantsModule } from '../tenants/tenants.module.js'
|
||||
import { PlatformReportsController } from './platform-reports.controller.js'
|
||||
import { UsersController } from './users.controller.js'
|
||||
import { UsersService } from './users.service.js'
|
||||
|
||||
@@ -33,7 +34,7 @@ import { UsersService } from './users.service.js'
|
||||
IntegrationsModule,
|
||||
TenantsModule,
|
||||
],
|
||||
controllers: [UsersController],
|
||||
controllers: [UsersController, PlatformReportsController],
|
||||
providers: [UsersService],
|
||||
exports: [UsersService],
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user