feat: Complete NestJS backend scaffold — 22 modules, 39 entities, WebSocket gateway
All checks were successful
Test Asgard Runner / test (push) Successful in 3s
All checks were successful
Test Asgard Runner / test (push) Successful in 3s
Full backend rewrite from Rust/Axum to NestJS/TypeScript. - 22 feature modules (auth, servers, wipes, maps, plugins, players, console, chat, team, notifications, settings, schedules, analytics, alerts, status, store, webstore, admin, setup, migration, users, licenses) - 39 TypeORM entities matching PostgreSQL schema (12 migrations) - Common infrastructure: JWT/RBAC guards, decorators, exception filter - NATS service with pub/sub/request-reply - Socket.IO WebSocket gateway with NATS bridge - Docker: NestJS Dockerfile + updated docker-compose.yml - Zero compile errors (npx tsc --noEmit clean) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
65
backend-nest/src/modules/servers/servers.controller.ts
Normal file
65
backend-nest/src/modules/servers/servers.controller.ts
Normal file
@@ -0,0 +1,65 @@
|
||||
import { Controller, Get, Put, Post, Body, UseGuards } from '@nestjs/common';
|
||||
import { ApiTags, ApiBearerAuth, ApiOperation } from '@nestjs/swagger';
|
||||
import { ServersService } from './servers.service';
|
||||
import { UpdateServerConfigDto } from './dto/update-config.dto';
|
||||
import { SendCommandDto } from './dto/send-command.dto';
|
||||
import { CurrentTenant } from '../../common/decorators/current-tenant.decorator';
|
||||
import { RequirePermission } from '../../common/decorators/require-permission.decorator';
|
||||
import { JwtAuthGuard } from '../../common/guards/jwt-auth.guard';
|
||||
import { PermissionsGuard } from '../../common/guards/permissions.guard';
|
||||
|
||||
@ApiTags('Servers')
|
||||
@ApiBearerAuth()
|
||||
@Controller('servers')
|
||||
@UseGuards(JwtAuthGuard, PermissionsGuard)
|
||||
export class ServersController {
|
||||
constructor(private readonly serversService: ServersService) {}
|
||||
|
||||
@Get()
|
||||
@RequirePermission('server.view')
|
||||
@ApiOperation({ summary: 'Get server connection and config' })
|
||||
async getServer(@CurrentTenant() licenseId: string) {
|
||||
return await this.serversService.getServer(licenseId);
|
||||
}
|
||||
|
||||
@Put('config')
|
||||
@RequirePermission('server.manage')
|
||||
@ApiOperation({ summary: 'Update server configuration' })
|
||||
async updateConfig(
|
||||
@CurrentTenant() licenseId: string,
|
||||
@Body() dto: UpdateServerConfigDto,
|
||||
) {
|
||||
return await this.serversService.updateConfig(licenseId, dto);
|
||||
}
|
||||
|
||||
@Post('command')
|
||||
@RequirePermission('server.console')
|
||||
@ApiOperation({ summary: 'Send console command to server' })
|
||||
async sendCommand(
|
||||
@CurrentTenant() licenseId: string,
|
||||
@Body() dto: SendCommandDto,
|
||||
) {
|
||||
return await this.serversService.sendCommand(licenseId, dto.command);
|
||||
}
|
||||
|
||||
@Post('start')
|
||||
@RequirePermission('server.manage')
|
||||
@ApiOperation({ summary: 'Start the server' })
|
||||
async startServer(@CurrentTenant() licenseId: string) {
|
||||
return await this.serversService.startServer(licenseId);
|
||||
}
|
||||
|
||||
@Post('stop')
|
||||
@RequirePermission('server.manage')
|
||||
@ApiOperation({ summary: 'Stop the server' })
|
||||
async stopServer(@CurrentTenant() licenseId: string) {
|
||||
return await this.serversService.stopServer(licenseId);
|
||||
}
|
||||
|
||||
@Post('restart')
|
||||
@RequirePermission('server.manage')
|
||||
@ApiOperation({ summary: 'Restart the server' })
|
||||
async restartServer(@CurrentTenant() licenseId: string) {
|
||||
return await this.serversService.restartServer(licenseId);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user