From 5c45557537259cb29287dffaef4f4f45d5f7372b Mon Sep 17 00:00:00 2001 From: Tiago Yamamoto Date: Mon, 15 Dec 2025 10:35:15 -0300 Subject: [PATCH] fix(backoffice): resolve eslint errors (async/await usage and floating promises) --- backoffice/src/admin/admin.controller.ts | 23 +++++++++---- backoffice/src/admin/admin.service.ts | 43 +++++++++++++++--------- backoffice/src/main.ts | 17 +++++++--- 3 files changed, 57 insertions(+), 26 deletions(-) diff --git a/backoffice/src/admin/admin.controller.ts b/backoffice/src/admin/admin.controller.ts index 34659bd..e49e045 100644 --- a/backoffice/src/admin/admin.controller.ts +++ b/backoffice/src/admin/admin.controller.ts @@ -5,14 +5,23 @@ import { AdminService } from './admin.service'; @ApiTags('Admin Dashboard') @Controller('admin') export class AdminController { - constructor(private readonly adminService: AdminService) { } + constructor(private readonly adminService: AdminService) {} - @Get('stats') @ApiOperation({ summary: 'Get dashboard stats' }) - async getDashboardStats() { return this.adminService.getDashboardStats(); } + @Get('stats') + @ApiOperation({ summary: 'Get dashboard stats' }) + getDashboardStats() { + return this.adminService.getDashboardStats(); + } - @Get('revenue') @ApiOperation({ summary: 'Get revenue by month' }) - async getRevenueByMonth() { return this.adminService.getRevenueByMonth(); } + @Get('revenue') + @ApiOperation({ summary: 'Get revenue by month' }) + getRevenueByMonth() { + return this.adminService.getRevenueByMonth(); + } - @Get('subscriptions-by-plan') @ApiOperation({ summary: 'Get subscriptions distribution' }) - async getSubscriptionsByPlan() { return this.adminService.getSubscriptionsByPlan(); } + @Get('subscriptions-by-plan') + @ApiOperation({ summary: 'Get subscriptions distribution' }) + getSubscriptionsByPlan() { + return this.adminService.getSubscriptionsByPlan(); + } } diff --git a/backoffice/src/admin/admin.service.ts b/backoffice/src/admin/admin.service.ts index c67fda0..1b8aacc 100644 --- a/backoffice/src/admin/admin.service.ts +++ b/backoffice/src/admin/admin.service.ts @@ -2,21 +2,34 @@ 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, - }; - } + 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 }, - ]; - } + 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 }]; - } + getSubscriptionsByPlan() { + return [ + { plan: 'Starter', count: 10 }, + { plan: 'Professional', count: 12 }, + { plan: 'Enterprise', count: 3 }, + ]; + } } diff --git a/backoffice/src/main.ts b/backoffice/src/main.ts index 27de636..360affc 100644 --- a/backoffice/src/main.ts +++ b/backoffice/src/main.ts @@ -6,21 +6,30 @@ import { AppModule } from './app.module'; async function bootstrap() { const app = await NestFactory.create(AppModule, { rawBody: true }); - app.enableCors({ origin: ['http://localhost:3000', 'https://gohorsejobs.com'], credentials: true }); + app.enableCors({ + origin: ['http://localhost:3000', 'https://gohorsejobs.com'], + credentials: true, + }); app.useGlobalPipes(new ValidationPipe({ whitelist: true, transform: true })); const config = new DocumentBuilder() .setTitle('GoHorse Backoffice API') .setDescription('SaaS Administration and Subscription Management') .setVersion('1.0') - .addTag('Stripe').addTag('Plans').addTag('Admin Dashboard') + .addTag('Stripe') + .addTag('Plans') + .addTag('Admin Dashboard') .addBearerAuth() .build(); - SwaggerModule.setup('api/docs', app, SwaggerModule.createDocument(app, config)); + SwaggerModule.setup( + 'api/docs', + app, + SwaggerModule.createDocument(app, config), + ); const port = process.env.PORT || 3001; await app.listen(port); console.log(`🚀 Backoffice API: http://localhost:${port}`); console.log(`📚 Swagger docs: http://localhost:${port}/api/docs`); } -bootstrap(); +void bootstrap();