From 73e6b2b310196602cedfefcab25ca4c59c80d116 Mon Sep 17 00:00:00 2001 From: Tiago Yamamoto Date: Mon, 15 Dec 2025 09:44:21 -0300 Subject: [PATCH] =?UTF-8?q?feat(admin):=20=F0=9F=91=91=20added=20admin=20d?= =?UTF-8?q?ashboard=20with=20stats?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backoffice/src/admin/admin.controller.ts | 18 ++++++++++++++++++ backoffice/src/admin/admin.module.ts | 10 ++++++++++ backoffice/src/admin/admin.service.ts | 22 ++++++++++++++++++++++ backoffice/src/admin/index.ts | 3 +++ 4 files changed, 53 insertions(+) create mode 100644 backoffice/src/admin/admin.controller.ts create mode 100644 backoffice/src/admin/admin.module.ts create mode 100644 backoffice/src/admin/admin.service.ts create mode 100644 backoffice/src/admin/index.ts diff --git a/backoffice/src/admin/admin.controller.ts b/backoffice/src/admin/admin.controller.ts new file mode 100644 index 0000000..34659bd --- /dev/null +++ b/backoffice/src/admin/admin.controller.ts @@ -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(); } +} diff --git a/backoffice/src/admin/admin.module.ts b/backoffice/src/admin/admin.module.ts new file mode 100644 index 0000000..d0b4ba8 --- /dev/null +++ b/backoffice/src/admin/admin.module.ts @@ -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 { } diff --git a/backoffice/src/admin/admin.service.ts b/backoffice/src/admin/admin.service.ts new file mode 100644 index 0000000..c67fda0 --- /dev/null +++ b/backoffice/src/admin/admin.service.ts @@ -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 }]; + } +} diff --git a/backoffice/src/admin/index.ts b/backoffice/src/admin/index.ts new file mode 100644 index 0000000..bac126e --- /dev/null +++ b/backoffice/src/admin/index.ts @@ -0,0 +1,3 @@ +export * from './admin.module'; +export * from './admin.service'; +export * from './admin.controller';