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

@@ -21,35 +21,29 @@ export class NotificationsConfig {
@Column({ type: 'boolean', default: false })
pushbullet_enabled: boolean;
@Column({ type: 'boolean', default: false })
email_enabled: boolean;
@Column({ type: 'text', nullable: true })
email_address: string | null;
@Column({ type: 'boolean', default: true })
email_alerts_enabled: boolean;
@Column({ type: 'boolean', default: true })
notify_on_start: boolean;
notify_wipe_start: boolean;
@Column({ type: 'boolean', default: true })
notify_on_stop: boolean;
notify_wipe_complete: boolean;
@Column({ type: 'boolean', default: true })
notify_on_crash: boolean;
notify_wipe_failed: boolean;
@Column({ type: 'boolean', default: true })
notify_on_wipe_start: boolean;
notify_server_crash: boolean;
@Column({ type: 'boolean', default: true })
notify_on_wipe_complete: boolean;
notify_server_offline: boolean;
@Column({ type: 'boolean', default: true })
notify_on_wipe_failure: boolean;
notify_store_purchase: boolean;
@Column({ type: 'boolean', default: false })
notify_on_player_threshold: boolean;
@Column({ type: 'int', nullable: true })
player_threshold: number | null;
notify_player_report: boolean;
@Column({ type: 'timestamptz', default: () => 'NOW()' })
created_at: Date;

View File

@@ -12,9 +12,6 @@ export class Role {
@Column({ type: 'varchar', length: 50 })
role_name: string;
@Column({ type: 'text', nullable: true })
description: string | null;
@Column({ type: 'boolean', default: false })
is_system_default: boolean;

View File

@@ -26,10 +26,7 @@ export class ScheduledTask {
task_config: Record<string, any>;
@Column({ type: 'boolean', default: true })
is_enabled: boolean;
@Column({ type: 'timestamptz', nullable: true })
last_run: Date | null;
is_active: boolean;
@Column({ type: 'timestamptz', nullable: true })
next_run: Date | null;

View File

@@ -21,8 +21,8 @@ export class TeamMember {
@Column({ type: 'uuid' })
invited_by: string;
@Column({ type: 'timestamptz', default: () => 'NOW()' })
joined_at: Date;
@Column({ type: 'timestamptz', nullable: true })
accepted_at: Date | null;
@Column({ type: 'timestamptz', default: () => 'NOW()' })
created_at: Date;

View File

@@ -15,11 +15,11 @@ export class WipeProfile {
@Column({ type: 'text', nullable: true })
description: string | null;
@Column({ type: 'jsonb', nullable: true })
pre_wipe_config: Record<string, any> | null;
@Column({ type: 'jsonb', default: {} })
pre_wipe_config: Record<string, any>;
@Column({ type: 'jsonb', nullable: true })
post_wipe_config: Record<string, any> | null;
@Column({ type: 'jsonb', default: {} })
post_wipe_config: Record<string, any>;
@Column({ type: 'timestamptz', default: () => 'NOW()' })
created_at: Date;