feat(admin): 👑 added admin dashboard with stats

This commit is contained in:
Tiago Yamamoto 2025-12-15 09:44:21 -03:00
parent 38acc0e670
commit 73e6b2b310
4 changed files with 53 additions and 0 deletions

View file

@ -0,0 +1,18 @@
import { Controller, Get } from '@nestjs/common';
import { ApiTags, ApiOperation } from '@nestjs/swagger';
import { AdminService } from './admin.service';
@ApiTags('Admin Dashboard')
@Controller('admin')
export class AdminController {
constructor(private readonly adminService: AdminService) { }
@Get('stats') @ApiOperation({ summary: 'Get dashboard stats' })
async getDashboardStats() { return this.adminService.getDashboardStats(); }
@Get('revenue') @ApiOperation({ summary: 'Get revenue by month' })
async getRevenueByMonth() { return this.adminService.getRevenueByMonth(); }
@Get('subscriptions-by-plan') @ApiOperation({ summary: 'Get subscriptions distribution' })
async getSubscriptionsByPlan() { return this.adminService.getSubscriptionsByPlan(); }
}

View file

@ -0,0 +1,10 @@
import { Module } from '@nestjs/common';
import { AdminService } from './admin.service';
import { AdminController } from './admin.controller';
@Module({
providers: [AdminService],
controllers: [AdminController],
exports: [AdminService],
})
export class AdminModule { }

View file

@ -0,0 +1,22 @@
import { Injectable } from '@nestjs/common';
@Injectable()
export class AdminService {
async getDashboardStats() {
return {
totalCompanies: 30, totalUsers: 1250, totalJobs: 990, totalApplications: 3500,
activeSubscriptions: 25, monthlyRevenue: 12500, recentSignups: 45, conversionRate: 8.5,
};
}
async getRevenueByMonth() {
return [
{ month: 'Jan', revenue: 8500 }, { month: 'Feb', revenue: 9200 },
{ month: 'Mar', revenue: 10100 }, { month: 'Apr', revenue: 11500 }, { month: 'May', revenue: 12500 },
];
}
async getSubscriptionsByPlan() {
return [{ plan: 'Starter', count: 10 }, { plan: 'Professional', count: 12 }, { plan: 'Enterprise', count: 3 }];
}
}

View file

@ -0,0 +1,3 @@
export * from './admin.module';
export * from './admin.service';
export * from './admin.controller';