Files
panel-pelican-dev/app/Enums/ServerUserSettingKey.php
Lance Pioch da64dbb6b5 Split backup notifications into manual and scheduled settings
Backups now record whether they were initiated by a schedule task via a
new is_scheduled column, set by CreateBackupSchema through the initiate
service. The per-user setting splits into manual_backup_notifications
and scheduled_backup_notifications, both opt-in, so users can subscribe
to each kind independently. The upgrade seeding grants owners both.

The backup origin is also exposed in the client API transformer.
2026-07-17 10:39:39 -04:00

32 lines
748 B
PHP

<?php
namespace App\Enums;
enum ServerUserSettingKey: string
{
case ManualBackupNotifications = 'manual_backup_notifications';
case ScheduledBackupNotifications = 'scheduled_backup_notifications';
/**
* The default value for users without an explicit setting.
*/
public function getDefaultValue(): bool
{
return match ($this) {
self::ManualBackupNotifications, self::ScheduledBackupNotifications => false,
};
}
/** @return array<string, bool> */
public static function getDefaultSettings(): array
{
$default = [];
foreach (self::cases() as $key) {
$default[$key->value] = $key->getDefaultValue();
}
return $default;
}
}