diff --git a/backend-nest/src/entities/notifications-config.entity.ts b/backend-nest/src/entities/notifications-config.entity.ts index 789d4c2..1a2ffcf 100644 --- a/backend-nest/src/entities/notifications-config.entity.ts +++ b/backend-nest/src/entities/notifications-config.entity.ts @@ -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; diff --git a/backend-nest/src/entities/role.entity.ts b/backend-nest/src/entities/role.entity.ts index e88954f..60970bc 100644 --- a/backend-nest/src/entities/role.entity.ts +++ b/backend-nest/src/entities/role.entity.ts @@ -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; diff --git a/backend-nest/src/entities/scheduled-task.entity.ts b/backend-nest/src/entities/scheduled-task.entity.ts index ceb2056..d2c4bcf 100644 --- a/backend-nest/src/entities/scheduled-task.entity.ts +++ b/backend-nest/src/entities/scheduled-task.entity.ts @@ -26,10 +26,7 @@ export class ScheduledTask { task_config: Record; @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; diff --git a/backend-nest/src/entities/team-member.entity.ts b/backend-nest/src/entities/team-member.entity.ts index ba5bd0a..b3b9f8a 100644 --- a/backend-nest/src/entities/team-member.entity.ts +++ b/backend-nest/src/entities/team-member.entity.ts @@ -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; diff --git a/backend-nest/src/entities/wipe-profile.entity.ts b/backend-nest/src/entities/wipe-profile.entity.ts index 3725d0f..22de562 100644 --- a/backend-nest/src/entities/wipe-profile.entity.ts +++ b/backend-nest/src/entities/wipe-profile.entity.ts @@ -15,11 +15,11 @@ export class WipeProfile { @Column({ type: 'text', nullable: true }) description: string | null; - @Column({ type: 'jsonb', nullable: true }) - pre_wipe_config: Record | null; + @Column({ type: 'jsonb', default: {} }) + pre_wipe_config: Record; - @Column({ type: 'jsonb', nullable: true }) - post_wipe_config: Record | null; + @Column({ type: 'jsonb', default: {} }) + post_wipe_config: Record; @Column({ type: 'timestamptz', default: () => 'NOW()' }) created_at: Date; diff --git a/backend-nest/src/modules/auth/jwt.strategy.ts b/backend-nest/src/modules/auth/jwt.strategy.ts index 04845b0..cd7da7a 100644 --- a/backend-nest/src/modules/auth/jwt.strategy.ts +++ b/backend-nest/src/modules/auth/jwt.strategy.ts @@ -73,7 +73,7 @@ export class JwtStrategy extends PassportStrategy(Strategy) { relations: ['license', 'role'], }); - if (teamMember && teamMember.joined_at) { + if (teamMember && teamMember.accepted_at) { license = teamMember.license; role = teamMember.role; } diff --git a/backend-nest/src/modules/notifications/dto/update-config.dto.ts b/backend-nest/src/modules/notifications/dto/update-config.dto.ts index 204844b..fa7c941 100644 --- a/backend-nest/src/modules/notifications/dto/update-config.dto.ts +++ b/backend-nest/src/modules/notifications/dto/update-config.dto.ts @@ -21,24 +21,6 @@ export class UpdateConfigDto { @IsOptional() discord_webhook_url?: string; - @ApiProperty({ - description: 'Enable email notifications', - example: true, - required: false, - }) - @IsBoolean() - @IsOptional() - email_enabled?: boolean; - - @ApiProperty({ - description: 'Email address for notifications', - example: 'admin@example.com', - required: false, - }) - @IsString() - @IsOptional() - email_address?: string; - @ApiProperty({ description: 'Enable Pushbullet notifications', example: false, @@ -58,31 +40,13 @@ export class UpdateConfigDto { pushbullet_api_key?: string; @ApiProperty({ - description: 'Notify on server start', + description: 'Enable email alert notifications', example: true, required: false, }) @IsBoolean() @IsOptional() - notify_on_start?: boolean; - - @ApiProperty({ - description: 'Notify on server stop', - example: true, - required: false, - }) - @IsBoolean() - @IsOptional() - notify_on_stop?: boolean; - - @ApiProperty({ - description: 'Notify on server crash', - example: true, - required: false, - }) - @IsBoolean() - @IsOptional() - notify_on_crash?: boolean; + email_alerts_enabled?: boolean; @ApiProperty({ description: 'Notify on wipe start', @@ -91,7 +55,7 @@ export class UpdateConfigDto { }) @IsBoolean() @IsOptional() - notify_on_wipe_start?: boolean; + notify_wipe_start?: boolean; @ApiProperty({ description: 'Notify on wipe complete', @@ -100,7 +64,7 @@ export class UpdateConfigDto { }) @IsBoolean() @IsOptional() - notify_on_wipe_complete?: boolean; + notify_wipe_complete?: boolean; @ApiProperty({ description: 'Notify on wipe failure', @@ -109,23 +73,41 @@ export class UpdateConfigDto { }) @IsBoolean() @IsOptional() - notify_on_wipe_failure?: boolean; + notify_wipe_failed?: boolean; @ApiProperty({ - description: 'Notify on player count threshold', + description: 'Notify on server crash', + example: true, + required: false, + }) + @IsBoolean() + @IsOptional() + notify_server_crash?: boolean; + + @ApiProperty({ + description: 'Notify when server goes offline', + example: true, + required: false, + }) + @IsBoolean() + @IsOptional() + notify_server_offline?: boolean; + + @ApiProperty({ + description: 'Notify on store purchase', + example: true, + required: false, + }) + @IsBoolean() + @IsOptional() + notify_store_purchase?: boolean; + + @ApiProperty({ + description: 'Notify on player report', example: false, required: false, }) @IsBoolean() @IsOptional() - notify_on_player_threshold?: boolean; - - @ApiProperty({ - description: 'Player count threshold', - example: '100', - required: false, - }) - @IsString() - @IsOptional() - player_threshold?: string; + notify_player_report?: boolean; } diff --git a/backend-nest/src/modules/notifications/notifications.service.ts b/backend-nest/src/modules/notifications/notifications.service.ts index 31c46e7..4035758 100644 --- a/backend-nest/src/modules/notifications/notifications.service.ts +++ b/backend-nest/src/modules/notifications/notifications.service.ts @@ -22,18 +22,16 @@ export class NotificationsService { license_id: licenseId, discord_enabled: false, discord_webhook_url: null, - email_enabled: false, - email_address: null, pushbullet_enabled: false, pushbullet_api_key: null, - notify_on_start: true, - notify_on_stop: true, - notify_on_crash: true, - notify_on_wipe_start: true, - notify_on_wipe_complete: true, - notify_on_wipe_failure: true, - notify_on_player_threshold: false, - player_threshold: null, + email_alerts_enabled: true, + notify_wipe_start: true, + notify_wipe_complete: true, + notify_wipe_failed: true, + notify_server_crash: true, + notify_server_offline: true, + notify_store_purchase: true, + notify_player_report: false, }); config = await this.configRepository.save(config); diff --git a/backend-nest/src/modules/schedules/dto/update-task.dto.ts b/backend-nest/src/modules/schedules/dto/update-task.dto.ts index 3e714e3..73ec81f 100644 --- a/backend-nest/src/modules/schedules/dto/update-task.dto.ts +++ b/backend-nest/src/modules/schedules/dto/update-task.dto.ts @@ -1,4 +1,14 @@ -import { PartialType } from '@nestjs/swagger'; +import { PartialType, ApiProperty } from '@nestjs/swagger'; +import { IsBoolean, IsOptional } from 'class-validator'; import { CreateTaskDto } from './create-task.dto'; -export class UpdateTaskDto extends PartialType(CreateTaskDto) {} +export class UpdateTaskDto extends PartialType(CreateTaskDto) { + @ApiProperty({ + description: 'Enable or disable the task', + example: true, + required: false, + }) + @IsBoolean() + @IsOptional() + is_active?: boolean; +} diff --git a/backend-nest/src/modules/schedules/schedules.service.ts b/backend-nest/src/modules/schedules/schedules.service.ts index 204da81..03a26ea 100644 --- a/backend-nest/src/modules/schedules/schedules.service.ts +++ b/backend-nest/src/modules/schedules/schedules.service.ts @@ -41,8 +41,7 @@ export class SchedulesService { cron_expression: dto.cron_expression, timezone: timezone, task_config: dto.task_config || {}, - is_enabled: true, - last_run: null, + is_active: true, next_run: null, // Would be calculated by scheduler created_at: new Date(), }); @@ -114,7 +113,7 @@ export class SchedulesService { throw new NotFoundException(`Scheduled task ${taskId} not found`); } - task.is_enabled = enabled; + task.is_active = enabled; const updated = await this.taskRepository.save(task); // TODO: Enable/disable task in scheduler diff --git a/backend-nest/src/modules/team/dto/create-role.dto.ts b/backend-nest/src/modules/team/dto/create-role.dto.ts index 0223827..a3a8f58 100644 --- a/backend-nest/src/modules/team/dto/create-role.dto.ts +++ b/backend-nest/src/modules/team/dto/create-role.dto.ts @@ -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; - @ApiProperty({ - description: 'Optional role description', - example: 'Custom role for moderators with limited permissions', - required: false, - }) - @IsString() - @IsOptional() - description?: string; } diff --git a/backend-nest/src/modules/team/team.service.ts b/backend-nest/src/modules/team/team.service.ts index 0be814c..e246098 100644 --- a/backend-nest/src/modules/team/team.service.ts +++ b/backend-nest/src/modules/team/team.service.ts @@ -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, });