mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-05 07:52:34 +00:00
Plugins base (#613)
* wip * wip * cleanup * notification channels * phpstan * services * remove server types * refactoring * refactoring
This commit is contained in:
@ -3,10 +3,11 @@
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Enums\BackupStatus;
|
||||
use App\Models\Backup;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<\App\Models\Backup>
|
||||
* @extends Factory<Backup>
|
||||
*/
|
||||
class BackupFactory extends Factory
|
||||
{
|
||||
|
@ -2,10 +2,11 @@
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\BackupFile;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<\App\Models\BackupFile>
|
||||
* @extends Factory<BackupFile>
|
||||
*/
|
||||
class BackupFileFactory extends Factory
|
||||
{
|
||||
|
@ -8,7 +8,7 @@
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<\App\Models\CommandExecution>
|
||||
* @extends Factory<CommandExecution>
|
||||
*/
|
||||
class CommandExecutionFactory extends Factory
|
||||
{
|
||||
|
@ -8,7 +8,7 @@
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
/**
|
||||
* @extends Factory<\App\Models\Command>
|
||||
* @extends Factory<Command>
|
||||
*/
|
||||
class CommandFactory extends Factory
|
||||
{
|
||||
|
@ -7,7 +7,7 @@
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<\App\Models\CronJob>
|
||||
* @extends Factory<CronJob>
|
||||
*/
|
||||
class CronJobFactory extends Factory
|
||||
{
|
||||
|
@ -7,7 +7,7 @@
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<\App\Models\Database>
|
||||
* @extends Factory<Database>
|
||||
*/
|
||||
class DatabaseFactory extends Factory
|
||||
{
|
||||
|
@ -6,7 +6,7 @@
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<\App\Models\DatabaseUser>
|
||||
* @extends Factory<DatabaseUser>
|
||||
*/
|
||||
class DatabaseUserFactory extends Factory
|
||||
{
|
||||
|
@ -6,7 +6,7 @@
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<\App\Models\Deployment>
|
||||
* @extends Factory<Deployment>
|
||||
*/
|
||||
class DeploymentFactory extends Factory
|
||||
{
|
||||
|
@ -8,7 +8,7 @@
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
/**
|
||||
* @extends Factory<\App\Models\DeploymentScript>
|
||||
* @extends Factory<DeploymentScript>
|
||||
*/
|
||||
class DeploymentScriptFactory extends Factory
|
||||
{
|
||||
|
@ -7,7 +7,7 @@
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
/**
|
||||
* @extends Factory<\App\Models\File>
|
||||
* @extends Factory<File>
|
||||
*/
|
||||
class FileFactory extends Factory
|
||||
{
|
||||
|
@ -6,7 +6,7 @@
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<\App\Models\FirewallRule>
|
||||
* @extends Factory<FirewallRule>
|
||||
*/
|
||||
class FirewallRuleFactory extends Factory
|
||||
{
|
||||
|
@ -9,7 +9,7 @@
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
/**
|
||||
* @extends Factory<\App\Models\GitHook>
|
||||
* @extends Factory<GitHook>
|
||||
*/
|
||||
class GitHookFactory extends Factory
|
||||
{
|
||||
|
@ -7,7 +7,7 @@
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
/**
|
||||
* @extends Factory<\App\Models\LoadBalancerServer>
|
||||
* @extends Factory<LoadBalancerServer>
|
||||
*/
|
||||
class LoadBalancerServerFactory extends Factory
|
||||
{
|
||||
|
@ -2,10 +2,11 @@
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Metric;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<\App\Models\Metric>
|
||||
* @extends Factory<Metric>
|
||||
*/
|
||||
class MetricFactory extends Factory
|
||||
{
|
||||
|
@ -2,10 +2,11 @@
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\NotificationChannel;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<\App\Models\NotificationChannel>
|
||||
* @extends Factory<NotificationChannel>
|
||||
*/
|
||||
class NotificationChannelFactory extends Factory
|
||||
{
|
||||
|
@ -7,7 +7,7 @@
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
/**
|
||||
* @extends Factory<\App\Models\Project>
|
||||
* @extends Factory<Project>
|
||||
*/
|
||||
class ProjectFactory extends Factory
|
||||
{
|
||||
|
@ -8,7 +8,7 @@
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
/**
|
||||
* @extends Factory<\App\Models\ScriptExecution>
|
||||
* @extends Factory<ScriptExecution>
|
||||
*/
|
||||
class ScriptExecutionFactory extends Factory
|
||||
{
|
||||
|
@ -7,7 +7,7 @@
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
/**
|
||||
* @extends Factory<\App\Models\Script>
|
||||
* @extends Factory<Script>
|
||||
*/
|
||||
class ScriptFactory extends Factory
|
||||
{
|
||||
|
@ -3,14 +3,13 @@
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Enums\OperatingSystem;
|
||||
use App\Enums\ServerProvider;
|
||||
use App\Enums\ServerStatus;
|
||||
use App\Enums\ServerType;
|
||||
use App\Models\Server;
|
||||
use App\ServerProviders\Custom;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<\App\Models\Server>
|
||||
* @extends Factory<Server>
|
||||
*/
|
||||
class ServerFactory extends Factory
|
||||
{
|
||||
@ -27,8 +26,7 @@ public function definition(): array
|
||||
'local_ip' => $this->faker->ipv4(),
|
||||
'port' => 22,
|
||||
'os' => OperatingSystem::UBUNTU22,
|
||||
'type' => ServerType::REGULAR,
|
||||
'provider' => ServerProvider::CUSTOM,
|
||||
'provider' => Custom::id(),
|
||||
'authentication' => [
|
||||
'user' => 'vito',
|
||||
'pass' => 'password',
|
||||
|
@ -6,7 +6,7 @@
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<\App\Models\ServerLog>
|
||||
* @extends Factory<ServerLog>
|
||||
*/
|
||||
class ServerLogFactory extends Factory
|
||||
{
|
||||
|
@ -7,7 +7,7 @@
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<\App\Models\ServerProvider>
|
||||
* @extends Factory<ServerProvider>
|
||||
*/
|
||||
class ServerProviderFactory extends Factory
|
||||
{
|
||||
@ -17,7 +17,7 @@ public function definition(): array
|
||||
{
|
||||
return [
|
||||
'profile' => $this->faker->word(),
|
||||
'provider' => $this->faker->randomElement(config('core.server_providers')),
|
||||
'provider' => $this->faker->randomElement(array_keys(config('server-provider.providers'))),
|
||||
'credentials' => [],
|
||||
'connected' => 1,
|
||||
'user_id' => User::factory(),
|
||||
|
@ -7,7 +7,7 @@
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<\App\Models\Service>
|
||||
* @extends Factory<Service>
|
||||
*/
|
||||
class ServiceFactory extends Factory
|
||||
{
|
||||
|
@ -2,12 +2,12 @@
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Enums\SiteType;
|
||||
use App\Models\Site;
|
||||
use App\SiteTypes\Laravel;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<\App\Models\Site>
|
||||
* @extends Factory<Site>
|
||||
*/
|
||||
class SiteFactory extends Factory
|
||||
{
|
||||
@ -17,7 +17,7 @@ public function definition(): array
|
||||
{
|
||||
return [
|
||||
'server_id' => 1,
|
||||
'type' => SiteType::LARAVEL,
|
||||
'type' => Laravel::id(),
|
||||
'domain' => 'test.com',
|
||||
'web_directory' => '/',
|
||||
'path' => '/home',
|
||||
|
@ -3,11 +3,14 @@
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\SourceControl;
|
||||
use App\SourceControlProviders\Bitbucket;
|
||||
use App\SourceControlProviders\Github;
|
||||
use App\SourceControlProviders\Gitlab;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* @extends Factory<\App\Models\SourceControl>
|
||||
* @extends Factory<SourceControl>
|
||||
*/
|
||||
class SourceControlFactory extends Factory
|
||||
{
|
||||
@ -17,39 +20,39 @@ public function definition(): array
|
||||
{
|
||||
return [
|
||||
'access_token' => Str::random(10),
|
||||
'provider' => \App\Enums\SourceControl::GITHUB,
|
||||
'provider' => Github::id(),
|
||||
'profile' => $this->faker->name,
|
||||
'project_id' => null,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Factory<\App\Models\SourceControl>
|
||||
* @return Factory<SourceControl>
|
||||
*/
|
||||
public function gitlab(): Factory
|
||||
{
|
||||
return $this->state(fn (array $attributes): array => [
|
||||
'provider' => \App\Enums\SourceControl::GITLAB,
|
||||
'provider' => Gitlab::id(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Factory<\App\Models\SourceControl>
|
||||
* @return Factory<SourceControl>
|
||||
*/
|
||||
public function github(): Factory
|
||||
{
|
||||
return $this->state(fn (array $attributes): array => [
|
||||
'provider' => \App\Enums\SourceControl::GITHUB,
|
||||
'provider' => Github::id(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Factory<\App\Models\SourceControl>
|
||||
* @return Factory<SourceControl>
|
||||
*/
|
||||
public function bitbucket(): Factory
|
||||
{
|
||||
return $this->state(fn (array $attributes): array => [
|
||||
'provider' => \App\Enums\SourceControl::BITBUCKET,
|
||||
'provider' => Bitbucket::id(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<\App\Models\SshKey>
|
||||
* @extends Factory<SshKey>
|
||||
*/
|
||||
class SshKeyFactory extends Factory
|
||||
{
|
||||
|
@ -8,7 +8,7 @@
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
/**
|
||||
* @extends Factory<\App\Models\Ssl>
|
||||
* @extends Factory<Ssl>
|
||||
*/
|
||||
class SslFactory extends Factory
|
||||
{
|
||||
|
@ -2,11 +2,12 @@
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\StorageProvider;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<\App\Models\StorageProvider>
|
||||
* @extends Factory<StorageProvider>
|
||||
*/
|
||||
class StorageProviderFactory extends Factory
|
||||
{
|
||||
@ -14,7 +15,7 @@ public function definition(): array
|
||||
{
|
||||
return [
|
||||
'profile' => $this->faker->word(),
|
||||
'provider' => $this->faker->randomElement(config('core.storage_providers')),
|
||||
'provider' => $this->faker->randomElement(array_keys(config('storage-provider.providers'))),
|
||||
'credentials' => [
|
||||
'token' => 'test-token',
|
||||
],
|
||||
|
@ -7,7 +7,7 @@
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
/**
|
||||
* @extends Factory<\App\Models\Tag>
|
||||
* @extends Factory<Tag>
|
||||
*/
|
||||
class TagFactory extends Factory
|
||||
{
|
||||
|
@ -8,7 +8,7 @@
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* @extends Factory<\App\Models\User>
|
||||
* @extends Factory<User>
|
||||
*/
|
||||
class UserFactory extends Factory
|
||||
{
|
||||
|
@ -16,6 +16,7 @@ class WorkerFactory extends Factory
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'name' => $this->faker->name,
|
||||
'command' => 'php artisan queue:work',
|
||||
'user' => 'vito',
|
||||
'auto_start' => 1,
|
||||
|
Reference in New Issue
Block a user