Files
corrosion-admin-panel/backend-nest/src/modules/settings/settings.controller.ts
Vantz Stockwell d20493d533
All checks were successful
Test Asgard Runner / test (push) Successful in 3s
feat: Complete NestJS backend scaffold — 22 modules, 39 entities, WebSocket gateway
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>
2026-02-15 21:29:25 -05:00

74 lines
2.1 KiB
TypeScript

import { Controller, Get, Put, Body, UseGuards } from '@nestjs/common';
import {
ApiTags,
ApiBearerAuth,
ApiOperation,
ApiResponse,
} from '@nestjs/swagger';
import { JwtAuthGuard } from '../../common/guards/jwt-auth.guard';
import { CurrentTenant } from '../../common/decorators/current-tenant.decorator';
import { SettingsService } from './settings.service';
import { UpdatePublicSiteDto } from './dto/update-public-site.dto';
import { UpdateDomainDto } from './dto/update-domain.dto';
@ApiTags('settings')
@ApiBearerAuth()
@UseGuards(JwtAuthGuard)
@Controller('settings')
export class SettingsController {
constructor(private readonly settingsService: SettingsService) {}
@Get('public-site')
@ApiOperation({
summary: 'Get public site configuration',
description: 'Returns public site settings for this license',
})
@ApiResponse({
status: 200,
description: 'Public site config retrieved successfully',
})
async getPublicSite(@CurrentTenant() licenseId: string) {
return await this.settingsService.getPublicSite(licenseId);
}
@Put('public-site')
@ApiOperation({
summary: 'Update public site configuration',
description: 'Update public site settings for this license',
})
@ApiResponse({
status: 200,
description: 'Public site config updated successfully',
})
async updatePublicSite(
@CurrentTenant() licenseId: string,
@Body() dto: UpdatePublicSiteDto,
) {
return await this.settingsService.updatePublicSite(licenseId, dto);
}
@Put('domain')
@ApiOperation({
summary: 'Update domain settings',
description: 'Update subdomain or custom domain for this license',
})
@ApiResponse({
status: 200,
description: 'Domain settings updated successfully',
})
@ApiResponse({
status: 400,
description: 'Invalid domain format',
})
@ApiResponse({
status: 409,
description: 'Subdomain already taken',
})
async updateDomain(
@CurrentTenant() licenseId: string,
@Body() dto: UpdateDomainDto,
) {
return await this.settingsService.updateDomain(licenseId, dto);
}
}