feat(admin): 👑 added admin dashboard with stats
This commit is contained in:
parent
38acc0e670
commit
73e6b2b310
4 changed files with 53 additions and 0 deletions
18
backoffice/src/admin/admin.controller.ts
Normal file
18
backoffice/src/admin/admin.controller.ts
Normal 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(); }
|
||||
}
|
||||
10
backoffice/src/admin/admin.module.ts
Normal file
10
backoffice/src/admin/admin.module.ts
Normal 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 { }
|
||||
22
backoffice/src/admin/admin.service.ts
Normal file
22
backoffice/src/admin/admin.service.ts
Normal 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 }];
|
||||
}
|
||||
}
|
||||
3
backoffice/src/admin/index.ts
Normal file
3
backoffice/src/admin/index.ts
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
export * from './admin.module';
|
||||
export * from './admin.service';
|
||||
export * from './admin.controller';
|
||||
Loading…
Reference in a new issue