feat: Complete NestJS backend scaffold — 22 modules, 39 entities, WebSocket gateway
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:
Vantz Stockwell
2026-02-15 21:29:25 -05:00
parent 0f8d0dd14f
commit d20493d533
141 changed files with 13552 additions and 4 deletions

View File

@@ -0,0 +1,158 @@
import {
Controller,
Get,
Post,
Put,
Delete,
Body,
Param,
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 { CurrentUser } from '../../common/decorators/current-user.decorator';
import { TeamService } from './team.service';
import { InviteMemberDto } from './dto/invite-member.dto';
import { CreateRoleDto } from './dto/create-role.dto';
import { UpdateRoleDto } from './dto/update-role.dto';
@ApiTags('team')
@ApiBearerAuth()
@UseGuards(JwtAuthGuard)
@Controller('team')
export class TeamController {
constructor(private readonly teamService: TeamService) {}
@Get()
@ApiOperation({
summary: 'Get team members and roles',
description: 'Returns all team members with their roles and all available roles',
})
@ApiResponse({
status: 200,
description: 'Team data retrieved successfully',
})
async getTeam(@CurrentTenant() licenseId: string) {
return await this.teamService.getTeam(licenseId);
}
@Post('invite')
@ApiOperation({
summary: 'Invite a team member',
description: 'Invite a user by email and assign them a role',
})
@ApiResponse({
status: 201,
description: 'Team member invited successfully',
})
@ApiResponse({
status: 404,
description: 'User not found',
})
@ApiResponse({
status: 409,
description: 'User already a team member',
})
async inviteMember(
@CurrentTenant() licenseId: string,
@CurrentUser('sub') userId: string,
@Body() dto: InviteMemberDto,
) {
return await this.teamService.inviteMember(licenseId, userId, dto);
}
@Delete(':id')
@ApiOperation({
summary: 'Remove a team member',
description: 'Remove a team member by ID',
})
@ApiResponse({
status: 200,
description: 'Team member removed successfully',
})
@ApiResponse({
status: 404,
description: 'Team member not found',
})
async removeMember(
@CurrentTenant() licenseId: string,
@Param('id') memberId: string,
) {
return await this.teamService.removeMember(licenseId, memberId);
}
@Post('roles')
@ApiOperation({
summary: 'Create a custom role',
description: 'Create a new custom role for this license',
})
@ApiResponse({
status: 201,
description: 'Role created successfully',
})
@ApiResponse({
status: 409,
description: 'Role name already exists',
})
async createRole(
@CurrentTenant() licenseId: string,
@Body() dto: CreateRoleDto,
) {
return await this.teamService.createRole(licenseId, dto);
}
@Put('roles/:id')
@ApiOperation({
summary: 'Update a role',
description: 'Update role permissions and details',
})
@ApiResponse({
status: 200,
description: 'Role updated successfully',
})
@ApiResponse({
status: 400,
description: 'Cannot modify system roles',
})
@ApiResponse({
status: 404,
description: 'Role not found',
})
async updateRole(
@CurrentTenant() licenseId: string,
@Param('id') roleId: string,
@Body() dto: UpdateRoleDto,
) {
return await this.teamService.updateRole(licenseId, roleId, dto);
}
@Delete('roles/:id')
@ApiOperation({
summary: 'Delete a role',
description: 'Delete a custom role (cannot delete system roles or roles in use)',
})
@ApiResponse({
status: 200,
description: 'Role deleted successfully',
})
@ApiResponse({
status: 400,
description: 'Cannot delete system roles or roles in use',
})
@ApiResponse({
status: 404,
description: 'Role not found',
})
async deleteRole(
@CurrentTenant() licenseId: string,
@Param('id') roleId: string,
) {
return await this.teamService.deleteRole(licenseId, roleId);
}
}