api(application): v2 backport

This commit is contained in:
Matthew Penner 2022-12-14 17:05:46 -07:00
parent 4cd0bee231
commit 67bf3e342e
No known key found for this signature in database
172 changed files with 2922 additions and 1579 deletions

View file

@ -48,7 +48,7 @@ class ActivityLogController extends ClientApiController
->appends($request->query());
return $this->fractal->collection($activity)
->transformWith($this->getTransformer(ActivityLogTransformer::class))
->transformWith(ActivityLogTransformer::class)
->toArray();
}
}

View file

@ -49,7 +49,7 @@ class BackupController extends ClientApiController
$limit = min($request->query('per_page') ?? 20, 50);
return $this->fractal->collection($server->backups()->paginate($limit))
->transformWith($this->getTransformer(BackupTransformer::class))
->transformWith(BackupTransformer::class)
->addMeta([
'backup_count' => $this->repository->getNonFailedBackups($server)->count(),
])
@ -84,7 +84,7 @@ class BackupController extends ClientApiController
->log();
return $this->fractal->item($backup)
->transformWith($this->getTransformer(BackupTransformer::class))
->transformWith(BackupTransformer::class)
->toArray();
}
@ -107,7 +107,7 @@ class BackupController extends ClientApiController
Activity::event($action)->subject($backup)->property('name', $backup->name)->log();
return $this->fractal->item($backup)
->transformWith($this->getTransformer(BackupTransformer::class))
->transformWith(BackupTransformer::class)
->toArray();
}
@ -123,7 +123,7 @@ class BackupController extends ClientApiController
}
return $this->fractal->item($backup)
->transformWith($this->getTransformer(BackupTransformer::class))
->transformWith(BackupTransformer::class)
->toArray();
}

View file

@ -35,7 +35,7 @@ class DatabaseController extends ClientApiController
public function index(GetDatabasesRequest $request, Server $server): array
{
return $this->fractal->collection($server->databases)
->transformWith($this->getTransformer(DatabaseTransformer::class))
->transformWith(DatabaseTransformer::class)
->toArray();
}
@ -57,7 +57,7 @@ class DatabaseController extends ClientApiController
return $this->fractal->item($database)
->parseIncludes(['password'])
->transformWith($this->getTransformer(DatabaseTransformer::class))
->transformWith(DatabaseTransformer::class)
->toArray();
}
@ -79,7 +79,7 @@ class DatabaseController extends ClientApiController
return $this->fractal->item($database)
->parseIncludes(['password'])
->transformWith($this->getTransformer(DatabaseTransformer::class))
->transformWith(DatabaseTransformer::class)
->toArray();
}

View file

@ -47,7 +47,7 @@ class FileController extends ClientApiController
->getDirectory($request->get('directory') ?? '/');
return $this->fractal->collection($contents)
->transformWith($this->getTransformer(FileObjectTransformer::class))
->transformWith(FileObjectTransformer::class)
->toArray();
}
@ -183,7 +183,7 @@ class FileController extends ClientApiController
->log();
return $this->fractal->item($file)
->transformWith($this->getTransformer(FileObjectTransformer::class))
->transformWith(FileObjectTransformer::class)
->toArray();
}

View file

@ -36,7 +36,7 @@ class NetworkAllocationController extends ClientApiController
public function index(GetNetworkRequest $request, Server $server): array
{
return $this->fractal->collection($server->allocations)
->transformWith($this->getTransformer(AllocationTransformer::class))
->transformWith(AllocationTransformer::class)
->toArray();
}
@ -60,7 +60,7 @@ class NetworkAllocationController extends ClientApiController
}
return $this->fractal->item($allocation)
->transformWith($this->getTransformer(AllocationTransformer::class))
->transformWith(AllocationTransformer::class)
->toArray();
}
@ -80,7 +80,7 @@ class NetworkAllocationController extends ClientApiController
->log();
return $this->fractal->item($allocation)
->transformWith($this->getTransformer(AllocationTransformer::class))
->transformWith(AllocationTransformer::class)
->toArray();
}
@ -104,7 +104,7 @@ class NetworkAllocationController extends ClientApiController
->log();
return $this->fractal->item($allocation)
->transformWith($this->getTransformer(AllocationTransformer::class))
->transformWith(AllocationTransformer::class)
->toArray();
}

View file

@ -35,7 +35,7 @@ class ResourceUtilizationController extends ClientApiController
});
return $this->fractal->item($stats)
->transformWith($this->getTransformer(StatsTransformer::class))
->transformWith(StatsTransformer::class)
->toArray();
}
}

View file

@ -40,7 +40,7 @@ class ScheduleController extends ClientApiController
$schedules = $server->schedules->loadMissing('tasks');
return $this->fractal->collection($schedules)
->transformWith($this->getTransformer(ScheduleTransformer::class))
->transformWith(ScheduleTransformer::class)
->toArray();
}
@ -72,7 +72,7 @@ class ScheduleController extends ClientApiController
->log();
return $this->fractal->item($model)
->transformWith($this->getTransformer(ScheduleTransformer::class))
->transformWith(ScheduleTransformer::class)
->toArray();
}
@ -88,7 +88,7 @@ class ScheduleController extends ClientApiController
$schedule->loadMissing('tasks');
return $this->fractal->item($schedule)
->transformWith($this->getTransformer(ScheduleTransformer::class))
->transformWith(ScheduleTransformer::class)
->toArray();
}
@ -131,7 +131,7 @@ class ScheduleController extends ClientApiController
->log();
return $this->fractal->item($schedule->refresh())
->transformWith($this->getTransformer(ScheduleTransformer::class))
->transformWith(ScheduleTransformer::class)
->toArray();
}

View file

@ -64,7 +64,7 @@ class ScheduleTaskController extends ClientApiController
->log();
return $this->fractal->item($task)
->transformWith($this->getTransformer(TaskTransformer::class))
->transformWith(TaskTransformer::class)
->toArray();
}
@ -97,7 +97,7 @@ class ScheduleTaskController extends ClientApiController
->log();
return $this->fractal->item($task->refresh())
->transformWith($this->getTransformer(TaskTransformer::class))
->transformWith(TaskTransformer::class)
->toArray();
}

View file

@ -25,7 +25,7 @@ class ServerController extends ClientApiController
public function index(GetServerRequest $request, Server $server): array
{
return $this->fractal->item($server)
->transformWith($this->getTransformer(ServerTransformer::class))
->transformWith(ServerTransformer::class)
->addMeta([
'is_server_owner' => $request->user()->id === $server->owner_id,
'user_permissions' => $this->permissionsService->handle($server, $request->user()),

View file

@ -34,7 +34,7 @@ class StartupController extends ClientApiController
return $this->fractal->collection(
$server->variables()->where('user_viewable', true)->get()
)
->transformWith($this->getTransformer(EggVariableTransformer::class))
->transformWith(EggVariableTransformer::class)
->addMeta([
'startup_command' => $startup,
'docker_images' => $server->egg->docker_images,
@ -90,7 +90,7 @@ class StartupController extends ClientApiController
}
return $this->fractal->item($variable)
->transformWith($this->getTransformer(EggVariableTransformer::class))
->transformWith(EggVariableTransformer::class)
->addMeta([
'startup_command' => $startup,
'raw_startup_command' => $server->startup,

View file

@ -38,7 +38,7 @@ class SubuserController extends ClientApiController
public function index(GetSubuserRequest $request, Server $server): array
{
return $this->fractal->collection($server->subusers)
->transformWith($this->getTransformer(SubuserTransformer::class))
->transformWith(SubuserTransformer::class)
->toArray();
}
@ -50,7 +50,7 @@ class SubuserController extends ClientApiController
$subuser = $request->attributes->get('subuser');
return $this->fractal->item($subuser)
->transformWith($this->getTransformer(SubuserTransformer::class))
->transformWith(SubuserTransformer::class)
->toArray();
}
@ -76,7 +76,7 @@ class SubuserController extends ClientApiController
->log();
return $this->fractal->item($response)
->transformWith($this->getTransformer(SubuserTransformer::class))
->transformWith(SubuserTransformer::class)
->toArray();
}
@ -129,7 +129,7 @@ class SubuserController extends ClientApiController
$log->reset();
return $this->fractal->item($subuser->refresh())
->transformWith($this->getTransformer(SubuserTransformer::class))
->transformWith(SubuserTransformer::class)
->toArray();
}