import { Controller, Get, UseGuards } from '@nestjs/common'; import { ApiTags, ApiOperation } from '@nestjs/swagger'; import { SetMetadata } from '@nestjs/common'; import { AdminService } from './admin.service'; import { IS_PUBLIC_KEY } from '../../common/guards/jwt-auth.guard'; import { JwtAuthGuard } from '../../common/guards/jwt-auth.guard'; import { CurrentUser } from '../../common/decorators/current-user.decorator'; @ApiTags('Admin') @Controller('admin') export class AdminController { constructor(private readonly adminService: AdminService) {} @Get('health') @SetMetadata(IS_PUBLIC_KEY, true) @ApiOperation({ summary: 'Health check endpoint' }) health() { return this.adminService.getHealth(); } @Get('ready') @SetMetadata(IS_PUBLIC_KEY, true) @ApiOperation({ summary: 'Database and Redis readiness check' }) ready() { return this.adminService.getReadiness(); } @Get('metrics') @UseGuards(JwtAuthGuard) @ApiOperation({ summary: 'Application metrics' }) metrics(@CurrentUser('tenantId') tenantId: string) { return this.adminService.getMetrics(tenantId); } @Get('status') @UseGuards(JwtAuthGuard) @ApiOperation({ summary: 'TDLib client status' }) status(@CurrentUser('tenantId') tenantId: string) { return this.adminService.getClientStatus(tenantId); } @Get('alerts') @UseGuards(JwtAuthGuard) @ApiOperation({ summary: 'Evaluate active operational alerts' }) alerts(@CurrentUser('tenantId') tenantId: string) { return this.adminService.getAlerts(tenantId); } }