fix: 🚚 Move and remove some settings

This commit is contained in:
IceToast 2023-06-04 15:41:51 +02:00
parent da29ead3cd
commit b97bc8edf7
7 changed files with 4 additions and 34 deletions

View file

@ -6,13 +6,13 @@ use Spatie\LaravelSettings\Settings;
class InvoiceSettings extends Settings
{
public bool $enabled;
public ?string $company_address;
public ?string $company_mail;
public ?string $company_name;
public ?string $company_phone;
public ?string $company_vat;
public ?string $company_website;
public bool $enabled;
public ?string $prefix;
public static function group(): string

View file

@ -14,7 +14,6 @@ class MailSettings extends Settings
public ?string $mail_from_address;
public ?string $mail_from_name;
public ?string $mail_mailer;
public bool $mail_enabled;
public static function group(): string
{
@ -52,7 +51,6 @@ class MailSettings extends Settings
'mail_from_address' => 'nullable|string',
'mail_from_name' => 'nullable|string',
'mail_mailer' => 'nullable|string',
'mail_enabled' => 'nullable|string',
];
}
@ -105,10 +103,6 @@ class MailSettings extends Settings
'type' => 'string',
'description' => 'The mailer of your mail server.',
],
'mail_enabled' => [
'label' => 'Mail Enabled',
'type' => 'boolean',
],
];
}
}

View file

@ -9,7 +9,6 @@ class ServerSettings extends Settings
public int $allocation_limit;
public bool $creation_enabled;
public bool $enable_upgrade;
public bool $charge_first_hour;
public static function group(): string
{
@ -26,7 +25,6 @@ class ServerSettings extends Settings
'allocation_limit' => 'required|integer|min:0',
'creation_enabled' => 'nullable|string',
'enable_upgrade' => 'nullable|string',
'charge_first_hour' => 'nullable|string',
];
}
@ -54,11 +52,6 @@ class ServerSettings extends Settings
'type' => 'boolean',
'description' => 'Whether or not users can upgrade their servers.',
],
'charge_first_hour' => [
'label' => 'Charge First Hour',
'type' => 'boolean',
'description' => 'Whether or not the first hour of a server is charged.',
],
];
}
}

View file

@ -6,6 +6,8 @@ use Spatie\LaravelSettings\Settings;
class UserSettings extends Settings
{
public bool $register_ip_check;
public bool $creation_enabled;
public float $credits_reward_after_verify_discord;
public float $credits_reward_after_verify_email;
public bool $force_discord_verification;
@ -16,8 +18,6 @@ class UserSettings extends Settings
public int $server_limit_after_irl_purchase;
public int $server_limit_after_verify_discord;
public int $server_limit_after_verify_email;
public bool $register_ip_check;
public bool $creation_enabled;
public static function group(): string
{

View file

@ -28,7 +28,6 @@ return new class extends Migration
DB::table('settings')->where('key', 'REGISTER_IP_CHECK')->update(['key' => 'SETTINGS::SYSTEM:REGISTER_IP_CHECK']);
DB::table('settings')->where('key', 'CREDITS_DISPLAY_NAME')->update(['key' => 'SETTINGS::SYSTEM:CREDITS_DISPLAY_NAME']);
DB::table('settings')->where('key', 'ALLOCATION_LIMIT')->update(['key' => 'SETTINGS::SERVER:ALLOCATION_LIMIT']);
DB::table('settings')->where('key', 'SERVER_CREATE_CHARGE_FIRST_HOUR')->update(['key' => 'SETTINGS::SYSTEM:SERVER_CREATE_CHARGE_FIRST_HOUR']);
DB::table('settings')->where('key', 'SALES_TAX')->update(['key' => 'SETTINGS::PAYMENTS:SALES_TAX']);
}
@ -52,7 +51,6 @@ return new class extends Migration
DB::table('configurations')->where('key', 'SETTINGS::USER:FORCE_EMAIL_VERIFICATION')->update(['key' => 'FORCE_EMAIL_VERIFICATION']);
DB::table('configurations')->where('key', 'SETTINGS::USER:FORCE_DISCORD_VERIFICATION')->update(['key' => 'FORCE_DISCORD_VERIFICATION']);
DB::table('configurations')->where('key', 'SETTINGS::SYSTEM:REGISTER_IP_CHECK')->update(['key' => 'REGISTER_IP_CHECK']);
DB::table('configurations')->where('key', 'SETTINGS::SYSTEM:SERVER_CREATE_CHARGE_FIRST_HOUR')->update(['key' => 'SERVER_CREATE_CHARGE_FIRST_HOUR']);
DB::table('configurations')->where('key', 'SETTINGS::SERVER:ALLOCATION_LIMIT')->update(['key' => 'ALLOCATION_LIMIT']);
DB::table('configurations')->where('key', 'SETTINGS::SERVER:CREDITS_DISPLAY_NAME')->update(['key' => 'SETTINGS::SYSTEM:CREDITS_DISPLAY_NAME']);
DB::table('configurations')->where('key', 'SETTINGS::PAYMENTS:SALES_TAX')->update(['key' => 'SALES_TAX']);

View file

@ -18,7 +18,6 @@ class CreateMailSettings extends SettingsMigration
$this->migrator->add('mail.mail_from_address', $table_exists ? $this->getOldValue('SETTINGS::MAIL:FROM_ADDRESS') : env('MAIL_FROM_ADDRESS', 'example@example.com'));
$this->migrator->add('mail.mail_from_name', $table_exists ? $this->getOldValue('SETTINGS::MAIL:FROM_NAME') : env('APP_NAME', 'CtrlPanel.gg'));
$this->migrator->add('mail.mail_mailer', $table_exists ? $this->getOldValue('SETTINGS::MAIL:MAILER') : env('MAIL_MAILER', 'smtp'));
$this->migrator->add('mail.mail_enabled', true);
}
public function down(): void
@ -72,12 +71,7 @@ class CreateMailSettings extends SettingsMigration
'type' => 'string',
'description' => 'The mailer of the mail server.',
],
[
'key' => 'SETTINGS::MAIL:ENABLED',
'value' => $this->getNewValue('mail_enabled'),
'type' => 'boolean',
'description' => 'The enabled state of the mail server.',
],
]);
$this->migrator->delete('mail.mail_host');
@ -88,7 +82,6 @@ class CreateMailSettings extends SettingsMigration
$this->migrator->delete('mail.mail_from_address');
$this->migrator->delete('mail.mail_from_name');
$this->migrator->delete('mail.mail_mailer');
$this->migrator->delete('mail.mail_enabled');
}

View file

@ -13,7 +13,6 @@ class CreateServerSettings extends SettingsMigration
$this->migrator->add('server.allocation_limit', $table_exists ? $this->getOldValue('SETTINGS::SERVER:ALLOCATION_LIMIT') : 200);
$this->migrator->add('server.creation_enabled', $table_exists ? $this->getOldValue('SETTINGS::SYSTEM:CREATION_OF_NEW_SERVERS') : true);
$this->migrator->add('server.enable_upgrade', $table_exists ? $this->getOldValue('SETTINGS::SYSTEM:ENABLE_UPGRADE') : false);
$this->migrator->add('server.charge_first_hour', $table_exists ? $this->getOldValue('SETTINGS::SYSTEM:SERVER_CREATE_CHARGE_FIRST_HOUR') : false);
}
public function down(): void
@ -37,18 +36,11 @@ class CreateServerSettings extends SettingsMigration
'type' => 'boolean',
'description' => 'Whether or not users can upgrade their servers.',
],
[
'key' => 'SETTINGS::SYSTEM:SERVER_CREATE_CHARGE_FIRST_HOUR',
'value' => $this->getNewValue('charge_first_hour'),
'type' => 'boolean',
'description' => 'Whether or not to charge the user for the first hour of their server.',
],
]);
$this->migrator->delete('server.allocation_limit');
$this->migrator->delete('server.creation_enabled');
$this->migrator->delete('server.enable_upgrade');
$this->migrator->delete('server.charge_first_hour');
}
public function getNewValue(string $name)