mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-05 07:52:34 +00:00
API Feature (#334)
This commit is contained in:
25
app/Http/Resources/CronJobResource.php
Normal file
25
app/Http/Resources/CronJobResource.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use App\Models\CronJob;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
/** @mixin CronJob */
|
||||
class CronJobResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'server_id' => $this->server_id,
|
||||
'command' => $this->command,
|
||||
'user' => $this->user,
|
||||
'frequency' => $this->frequency,
|
||||
'status' => $this->status,
|
||||
'created_at' => $this->created_at,
|
||||
'updated_at' => $this->updated_at,
|
||||
];
|
||||
}
|
||||
}
|
23
app/Http/Resources/DatabaseResource.php
Normal file
23
app/Http/Resources/DatabaseResource.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use App\Models\Database;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
/** @mixin Database */
|
||||
class DatabaseResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'server_id' => $this->server_id,
|
||||
'name' => $this->name,
|
||||
'status' => $this->status,
|
||||
'created_at' => $this->created_at,
|
||||
'updated_at' => $this->updated_at,
|
||||
];
|
||||
}
|
||||
}
|
25
app/Http/Resources/DatabaseUserResource.php
Normal file
25
app/Http/Resources/DatabaseUserResource.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use App\Models\DatabaseUser;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
/** @mixin DatabaseUser */
|
||||
class DatabaseUserResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'server_id' => $this->server_id,
|
||||
'username' => $this->username,
|
||||
'databases' => $this->databases,
|
||||
'host' => $this->host,
|
||||
'status' => $this->status,
|
||||
'created_at' => $this->created_at,
|
||||
'updated_at' => $this->updated_at,
|
||||
];
|
||||
}
|
||||
}
|
28
app/Http/Resources/FirewallRuleResource.php
Normal file
28
app/Http/Resources/FirewallRuleResource.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use App\Models\FirewallRule;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
/** @mixin FirewallRule */
|
||||
class FirewallRuleResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'server_id' => $this->server_id,
|
||||
'type' => $this->type,
|
||||
'protocol' => $this->protocol,
|
||||
'port' => $this->port,
|
||||
'source' => $this->source,
|
||||
'mask' => $this->mask,
|
||||
'note' => $this->note,
|
||||
'status' => $this->status,
|
||||
'created_at' => $this->created_at,
|
||||
'updated_at' => $this->updated_at,
|
||||
];
|
||||
}
|
||||
}
|
21
app/Http/Resources/ProjectResource.php
Normal file
21
app/Http/Resources/ProjectResource.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use App\Models\Project;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
/** @mixin Project */
|
||||
class ProjectResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'name' => $this->name,
|
||||
'created_at' => $this->created_at,
|
||||
'updated_at' => $this->updated_at,
|
||||
];
|
||||
}
|
||||
}
|
24
app/Http/Resources/ServerProviderResource.php
Normal file
24
app/Http/Resources/ServerProviderResource.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use App\Models\ServerProvider;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
/** @mixin ServerProvider */
|
||||
class ServerProviderResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'project_id' => $this->project_id,
|
||||
'global' => is_null($this->project_id),
|
||||
'name' => $this->profile,
|
||||
'provider' => $this->provider,
|
||||
'created_at' => $this->created_at,
|
||||
'updated_at' => $this->updated_at,
|
||||
];
|
||||
}
|
||||
}
|
42
app/Http/Resources/ServerResource.php
Normal file
42
app/Http/Resources/ServerResource.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use App\Models\Server;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
/** @mixin Server */
|
||||
class ServerResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'project_id' => $this->project_id,
|
||||
'user_id' => $this->user_id,
|
||||
'provider_id' => $this->provider_id,
|
||||
'name' => $this->name,
|
||||
'ssh_user' => $this->ssh_user,
|
||||
'ip' => $this->ip,
|
||||
'local_ip' => $this->local_ip,
|
||||
'port' => $this->port,
|
||||
'os' => $this->os,
|
||||
'type' => $this->type,
|
||||
'type_data' => $this->type_data,
|
||||
'provider' => $this->provider,
|
||||
'provider_data' => $this->provider_data,
|
||||
'public_key' => $this->public_key,
|
||||
'status' => $this->status,
|
||||
'auto_update' => $this->auto_update,
|
||||
'available_updates' => $this->available_updates,
|
||||
'security_updates' => $this->security_updates,
|
||||
'progress' => $this->progress,
|
||||
'progress_step' => $this->progress_step,
|
||||
'updates' => $this->updates,
|
||||
'last_update_check' => $this->last_update_check,
|
||||
'created_at' => $this->created_at,
|
||||
'updated_at' => $this->updated_at,
|
||||
];
|
||||
}
|
||||
}
|
28
app/Http/Resources/ServiceResource.php
Normal file
28
app/Http/Resources/ServiceResource.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use App\Models\Service;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
/** @mixin Service */
|
||||
class ServiceResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'server_id' => $this->server_id,
|
||||
'type' => $this->type,
|
||||
'type_data' => $this->type_data,
|
||||
'name' => $this->name,
|
||||
'version' => $this->version,
|
||||
'unit' => $this->unit,
|
||||
'status' => $this->status,
|
||||
'is_default' => $this->is_default,
|
||||
'created_at' => $this->created_at,
|
||||
'updated_at' => $this->updated_at,
|
||||
];
|
||||
}
|
||||
}
|
34
app/Http/Resources/SiteResource.php
Normal file
34
app/Http/Resources/SiteResource.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use App\Models\Site;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
/** @mixin Site */
|
||||
class SiteResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'server_id' => $this->server_id,
|
||||
'source_control_id' => $this->source_control_id,
|
||||
'type' => $this->type,
|
||||
'type_data' => $this->type_data,
|
||||
'domain' => $this->domain,
|
||||
'aliases' => $this->aliases,
|
||||
'web_directory' => $this->web_directory,
|
||||
'path' => $this->path,
|
||||
'php_version' => $this->php_version,
|
||||
'repository' => $this->repository,
|
||||
'branch' => $this->branch,
|
||||
'status' => $this->status,
|
||||
'port' => $this->port,
|
||||
'progress' => $this->progress,
|
||||
'created_at' => $this->created_at,
|
||||
'updated_at' => $this->updated_at,
|
||||
];
|
||||
}
|
||||
}
|
24
app/Http/Resources/SourceControlResource.php
Normal file
24
app/Http/Resources/SourceControlResource.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use App\Models\SourceControl;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
/** @mixin SourceControl */
|
||||
class SourceControlResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'project_id' => $this->project_id,
|
||||
'global' => is_null($this->project_id),
|
||||
'name' => $this->profile,
|
||||
'provider' => $this->provider,
|
||||
'created_at' => $this->created_at,
|
||||
'updated_at' => $this->updated_at,
|
||||
];
|
||||
}
|
||||
}
|
22
app/Http/Resources/SshKeyResource.php
Normal file
22
app/Http/Resources/SshKeyResource.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use App\Models\SshKey;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
/** @mixin SshKey */
|
||||
class SshKeyResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'user' => $this->user_id ? new UserResource($this->user) : null,
|
||||
'name' => $this->name,
|
||||
'created_at' => $this->created_at,
|
||||
'updated_at' => $this->updated_at,
|
||||
];
|
||||
}
|
||||
}
|
24
app/Http/Resources/StorageProviderResource.php
Normal file
24
app/Http/Resources/StorageProviderResource.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use App\Models\StorageProvider;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
/** @mixin StorageProvider */
|
||||
class StorageProviderResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'project_id' => $this->project_id,
|
||||
'global' => is_null($this->project_id),
|
||||
'name' => $this->profile,
|
||||
'provider' => $this->provider,
|
||||
'created_at' => $this->created_at,
|
||||
'updated_at' => $this->updated_at,
|
||||
];
|
||||
}
|
||||
}
|
22
app/Http/Resources/UserResource.php
Normal file
22
app/Http/Resources/UserResource.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
/** @mixin User */
|
||||
class UserResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'name' => $this->name,
|
||||
'email' => $this->email,
|
||||
'created_at' => $this->created_at,
|
||||
'updated_at' => $this->updated_at,
|
||||
];
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user