Files
lingxi-web/telegram-gateway/src/modules/admin/admin.controller.ts
T
wmq 06112602ec feat(gateway): include production Telegram user gateway
Version the NestJS TDLib gateway with Docker deployment, migrations, automated tests and platform integration documentation while excluding all account sessions, credentials, runtime databases and backups.
2026-08-01 18:38:20 +08:00

49 lines
1.5 KiB
TypeScript

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);
}
}