fix: Align NestJS entities with actual DB schema — 12 files, 5 entities
All checks were successful
Test Asgard Runner / test (push) Successful in 3s

Root cause of all remaining 500s: TypeORM entities were scaffolded with
"ideal" column names that don't match the Postgres columns created by
the Rust migrations. Every query generated SQL referencing non-existent
columns.

Entity fixes:
- notifications_config: email_enabled→email_alerts_enabled, removed
  6 phantom columns (email_address, notify_on_start, notify_on_stop,
  notify_on_player_threshold, player_threshold), renamed 4 notify
  columns to match DB (notify_server_crash, notify_wipe_start, etc),
  added 3 missing columns (notify_server_offline, notify_store_purchase,
  notify_player_report)
- team_members: joined_at→accepted_at (nullable, matches DB)
- roles: removed description column (doesn't exist in DB)
- scheduled_tasks: is_enabled→is_active, removed phantom last_run
- wipe_profiles: pre/post_wipe_config nullable→NOT NULL with default

Service/DTO fixes:
- Updated all property references across notifications, team, schedules
  services and DTOs to match corrected entity names
- Added is_active to UpdateTaskDto (frontend sends it, was being
  rejected by forbidNonWhitelisted validation)
- Removed description from CreateRoleDto

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Vantz Stockwell
2026-02-15 22:33:55 -05:00
parent 3cb714a792
commit 78e97babf1
12 changed files with 78 additions and 110 deletions

View File

@@ -1,4 +1,4 @@
import { IsString, IsObject, IsOptional } from 'class-validator';
import { IsString, IsObject } from 'class-validator';
import { ApiProperty } from '@nestjs/swagger';
export class CreateRoleDto {
@@ -21,12 +21,4 @@ export class CreateRoleDto {
@IsObject()
permissions: Record<string, any>;
@ApiProperty({
description: 'Optional role description',
example: 'Custom role for moderators with limited permissions',
required: false,
})
@IsString()
@IsOptional()
description?: string;
}

View File

@@ -29,7 +29,7 @@ export class TeamService {
const members = await this.teamMemberRepository.find({
where: { license_id: licenseId },
relations: ['user', 'role'],
order: { joined_at: 'DESC' },
order: { accepted_at: 'DESC' },
});
// Get all roles (system defaults + custom roles for this license)
@@ -43,7 +43,7 @@ export class TeamService {
email: member.user?.email,
role_id: member.role_id,
role_name: member.role?.role_name,
joined_at: member.joined_at,
accepted_at: member.accepted_at,
invited_by: member.invited_by,
})),
roles,
@@ -101,7 +101,7 @@ export class TeamService {
user_id: user.id,
role_id: dto.role_id,
invited_by: invitedBy,
joined_at: new Date(),
accepted_at: new Date(),
});
const saved = await this.teamMemberRepository.save(teamMember);
@@ -123,7 +123,7 @@ export class TeamService {
email: memberWithData.user?.email,
role_id: memberWithData.role_id,
role_name: memberWithData.role?.role_name,
joined_at: memberWithData.joined_at,
accepted_at: memberWithData.accepted_at,
invited_by: memberWithData.invited_by,
};
}
@@ -177,7 +177,6 @@ export class TeamService {
license_id: licenseId,
role_name: dto.role_name,
permissions: dto.permissions,
description: dto.description,
is_system_default: false,
});