mirror of
https://github.com/AnimeThemes/animethemes-server.git
synced 2026-07-11 01:24:46 +02:00
docs: clean unnecessary phpdocs (#880)
This commit is contained in:
@@ -8,23 +8,12 @@ use App\Enums\Actions\ActionStatus;
|
|||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class ActionResult.
|
|
||||||
*/
|
|
||||||
class ActionResult
|
class ActionResult
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Create a new action result instance.
|
|
||||||
*
|
|
||||||
* @param ActionStatus $status
|
|
||||||
* @param string|null $message
|
|
||||||
*/
|
|
||||||
public function __construct(protected readonly ActionStatus $status, protected readonly ?string $message = null) {}
|
public function __construct(protected readonly ActionStatus $status, protected readonly ?string $message = null) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the action result status.
|
* Get the action result status.
|
||||||
*
|
|
||||||
* @return ActionStatus
|
|
||||||
*/
|
*/
|
||||||
public function getStatus(): ActionStatus
|
public function getStatus(): ActionStatus
|
||||||
{
|
{
|
||||||
@@ -33,8 +22,6 @@ class ActionResult
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the action result message.
|
* Get the action result message.
|
||||||
*
|
|
||||||
* @return string|null
|
|
||||||
*/
|
*/
|
||||||
public function getMessage(): ?string
|
public function getMessage(): ?string
|
||||||
{
|
{
|
||||||
@@ -43,8 +30,6 @@ class ActionResult
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Has the action failed?
|
* Has the action failed?
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
*/
|
||||||
public function hasFailed(): bool
|
public function hasFailed(): bool
|
||||||
{
|
{
|
||||||
@@ -53,8 +38,6 @@ class ActionResult
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Write results to log.
|
* Write results to log.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function toLog(): void
|
public function toLog(): void
|
||||||
{
|
{
|
||||||
@@ -65,9 +48,6 @@ class ActionResult
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Write results to console output.
|
* Write results to console output.
|
||||||
*
|
|
||||||
* @param Command $command
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function toConsole(Command $command): void
|
public function toConsole(Command $command): void
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,15 +10,10 @@ use Illuminate\Support\Arr;
|
|||||||
use Illuminate\Support\Facades\Config;
|
use Illuminate\Support\Facades\Config;
|
||||||
use Illuminate\Support\Facades\Http;
|
use Illuminate\Support\Facades\Http;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class DiscordMessageAction.
|
|
||||||
*/
|
|
||||||
class DiscordMessageAction
|
class DiscordMessageAction
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Get the HTTP client for Discord API.
|
* Get the HTTP client for Discord API.
|
||||||
*
|
|
||||||
* @return PendingRequest
|
|
||||||
*/
|
*/
|
||||||
public static function getHttp(): PendingRequest
|
public static function getHttp(): PendingRequest
|
||||||
{
|
{
|
||||||
@@ -30,7 +25,6 @@ class DiscordMessageAction
|
|||||||
* Make the Discord message.
|
* Make the Discord message.
|
||||||
*
|
*
|
||||||
* @param array<string, mixed> $fields
|
* @param array<string, mixed> $fields
|
||||||
* @return DiscordMessage
|
|
||||||
*/
|
*/
|
||||||
public function makeMessage(array $fields): DiscordMessage
|
public function makeMessage(array $fields): DiscordMessage
|
||||||
{
|
{
|
||||||
@@ -54,9 +48,6 @@ class DiscordMessageAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the Discord message.
|
* Set the Discord message.
|
||||||
*
|
|
||||||
* @param string $url
|
|
||||||
* @return DiscordMessage
|
|
||||||
*/
|
*/
|
||||||
public function get(string $url): DiscordMessage
|
public function get(string $url): DiscordMessage
|
||||||
{
|
{
|
||||||
@@ -72,9 +63,6 @@ class DiscordMessageAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Edit the Discord message.
|
* Edit the Discord message.
|
||||||
*
|
|
||||||
* @param DiscordMessage $message
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function edit(DiscordMessage $message): void
|
public function edit(DiscordMessage $message): void
|
||||||
{
|
{
|
||||||
@@ -87,9 +75,6 @@ class DiscordMessageAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Send the Discord message.
|
* Send the Discord message.
|
||||||
*
|
|
||||||
* @param DiscordMessage $message
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function send(DiscordMessage $message): void
|
public function send(DiscordMessage $message): void
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,17 +10,12 @@ use Exception;
|
|||||||
use Illuminate\Support\Arr;
|
use Illuminate\Support\Arr;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class DiscordThreadAction.
|
|
||||||
*/
|
|
||||||
class DiscordThreadAction
|
class DiscordThreadAction
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Handle the action.
|
* Handle the action.
|
||||||
*
|
*
|
||||||
* @param Anime $anime
|
|
||||||
* @param array<string, mixed> $fields
|
* @param array<string, mixed> $fields
|
||||||
* @return Exception|null
|
|
||||||
*/
|
*/
|
||||||
public function handle(Anime $anime, array $fields): ?Exception
|
public function handle(Anime $anime, array $fields): ?Exception
|
||||||
{
|
{
|
||||||
@@ -63,8 +58,7 @@ class DiscordThreadAction
|
|||||||
/**
|
/**
|
||||||
* Get the thread by ID.
|
* Get the thread by ID.
|
||||||
*
|
*
|
||||||
* @param string $id
|
* @return array<string, mixed>
|
||||||
* @return array
|
|
||||||
*/
|
*/
|
||||||
public function get(string $id): array
|
public function get(string $id): array
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,9 +9,6 @@ use App\Models\Wiki\Video;
|
|||||||
use Illuminate\Support\Arr;
|
use Illuminate\Support\Arr;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class DiscordVideoNotificationAction.
|
|
||||||
*/
|
|
||||||
class DiscordVideoNotificationAction
|
class DiscordVideoNotificationAction
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@@ -19,7 +16,6 @@ class DiscordVideoNotificationAction
|
|||||||
*
|
*
|
||||||
* @param Collection<int, Video> $videos
|
* @param Collection<int, Video> $videos
|
||||||
* @param array<string, mixed> $fields
|
* @param array<string, mixed> $fields
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function handle(Collection $videos, array $fields): void
|
public function handle(Collection $videos, array $fields): void
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -14,16 +14,12 @@ use Illuminate\Validation\Rules\Password;
|
|||||||
use Illuminate\Validation\ValidationException;
|
use Illuminate\Validation\ValidationException;
|
||||||
use Laravel\Fortify\Contracts\CreatesNewUsers;
|
use Laravel\Fortify\Contracts\CreatesNewUsers;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class CreateNewUser.
|
|
||||||
*/
|
|
||||||
class CreateNewUser implements CreatesNewUsers
|
class CreateNewUser implements CreatesNewUsers
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Validate and create a newly registered user.
|
* Validate and create a newly registered user.
|
||||||
*
|
*
|
||||||
* @param array<string, string> $input
|
* @param array<string, string> $input
|
||||||
* @return User
|
|
||||||
*
|
*
|
||||||
* @throws ValidationException
|
* @throws ValidationException
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -12,17 +12,12 @@ use Illuminate\Validation\Rules\Password;
|
|||||||
use Illuminate\Validation\ValidationException;
|
use Illuminate\Validation\ValidationException;
|
||||||
use Laravel\Fortify\Contracts\ResetsUserPasswords;
|
use Laravel\Fortify\Contracts\ResetsUserPasswords;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class ResetUserPassword.
|
|
||||||
*/
|
|
||||||
class ResetUserPassword implements ResetsUserPasswords
|
class ResetUserPassword implements ResetsUserPasswords
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Validate and reset the user's forgotten password.
|
* Validate and reset the user's forgotten password.
|
||||||
*
|
*
|
||||||
* @param User $user
|
|
||||||
* @param array<string, string> $input
|
* @param array<string, string> $input
|
||||||
* @return void
|
|
||||||
*
|
*
|
||||||
* @throws ValidationException
|
* @throws ValidationException
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -13,17 +13,12 @@ use Illuminate\Validation\ValidationException;
|
|||||||
use Illuminate\Validation\Validator as IlluminateValidator;
|
use Illuminate\Validation\Validator as IlluminateValidator;
|
||||||
use Laravel\Fortify\Contracts\UpdatesUserPasswords;
|
use Laravel\Fortify\Contracts\UpdatesUserPasswords;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class UpdateUserPassword.
|
|
||||||
*/
|
|
||||||
class UpdateUserPassword implements UpdatesUserPasswords
|
class UpdateUserPassword implements UpdatesUserPasswords
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Validate and update the user's password.
|
* Validate and update the user's password.
|
||||||
*
|
*
|
||||||
* @param User $user
|
|
||||||
* @param array<string, string> $input
|
* @param array<string, string> $input
|
||||||
* @return void
|
|
||||||
*
|
*
|
||||||
* @throws ValidationException
|
* @throws ValidationException
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -12,17 +12,12 @@ use Illuminate\Validation\Rule;
|
|||||||
use Illuminate\Validation\ValidationException;
|
use Illuminate\Validation\ValidationException;
|
||||||
use Laravel\Fortify\Contracts\UpdatesUserProfileInformation;
|
use Laravel\Fortify\Contracts\UpdatesUserProfileInformation;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class UpdateUserProfileInformation.
|
|
||||||
*/
|
|
||||||
class UpdateUserProfileInformation implements UpdatesUserProfileInformation
|
class UpdateUserProfileInformation implements UpdatesUserProfileInformation
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Validate and update the given user's profile information.
|
* Validate and update the given user's profile information.
|
||||||
*
|
*
|
||||||
* @param User $user
|
|
||||||
* @param array<string, string> $input
|
* @param array<string, string> $input
|
||||||
* @return void
|
|
||||||
*
|
*
|
||||||
* @throws ValidationException
|
* @throws ValidationException
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -16,11 +16,6 @@ use Illuminate\Support\Facades\Config;
|
|||||||
*/
|
*/
|
||||||
class DumpDownloadAction extends DownloadAction
|
class DumpDownloadAction extends DownloadAction
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Create a new action instance.
|
|
||||||
*
|
|
||||||
* @param Dump $dump
|
|
||||||
*/
|
|
||||||
public function __construct(Dump $dump)
|
public function __construct(Dump $dump)
|
||||||
{
|
{
|
||||||
parent::__construct($dump);
|
parent::__construct($dump);
|
||||||
@@ -28,8 +23,6 @@ class DumpDownloadAction extends DownloadAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the path of the resource in storage.
|
* Get the path of the resource in storage.
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
protected function path(): string
|
protected function path(): string
|
||||||
{
|
{
|
||||||
@@ -38,8 +31,6 @@ class DumpDownloadAction extends DownloadAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The name of the disk.
|
* The name of the disk.
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
public function disk(): string
|
public function disk(): string
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ class DestroyAction
|
|||||||
* Force delete model that doesn't apply soft deletes.
|
* Force delete model that doesn't apply soft deletes.
|
||||||
*
|
*
|
||||||
* @param TModel&Nameable $model
|
* @param TModel&Nameable $model
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
public function forceDelete(Model&Nameable $model): string
|
public function forceDelete(Model&Nameable $model): string
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -7,16 +7,10 @@ namespace App\Actions\Http\Api;
|
|||||||
use App\Models\BaseModel;
|
use App\Models\BaseModel;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class ForceDeleteAction.
|
|
||||||
*/
|
|
||||||
class ForceDeleteAction
|
class ForceDeleteAction
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Force delete model.
|
* Force delete model.
|
||||||
*
|
|
||||||
* @param BaseModel $model
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
public function forceDelete(BaseModel $model): string
|
public function forceDelete(BaseModel $model): string
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -20,20 +20,12 @@ use Illuminate\Support\Facades\App;
|
|||||||
use Illuminate\Support\Facades\Config;
|
use Illuminate\Support\Facades\Config;
|
||||||
use RuntimeException;
|
use RuntimeException;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class IndexAction.
|
|
||||||
*/
|
|
||||||
class IndexAction
|
class IndexAction
|
||||||
{
|
{
|
||||||
use ConstrainsEagerLoads;
|
use ConstrainsEagerLoads;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show paginated listing of models.
|
* Show paginated listing of models.
|
||||||
*
|
|
||||||
* @param Builder $builder
|
|
||||||
* @param Query $query
|
|
||||||
* @param Schema $schema
|
|
||||||
* @return Collection|Paginator
|
|
||||||
*/
|
*/
|
||||||
public function index(Builder $builder, Query $query, Schema $schema): Collection|Paginator
|
public function index(Builder $builder, Query $query, Schema $schema): Collection|Paginator
|
||||||
{
|
{
|
||||||
@@ -68,11 +60,6 @@ class IndexAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Search models.
|
* Search models.
|
||||||
*
|
|
||||||
* @param Query $query
|
|
||||||
* @param Schema $schema
|
|
||||||
* @param PaginationStrategy $paginationStrategy
|
|
||||||
* @return Collection|Paginator
|
|
||||||
*/
|
*/
|
||||||
public function search(
|
public function search(
|
||||||
Query $query,
|
Query $query,
|
||||||
@@ -93,8 +80,6 @@ class IndexAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the search instance.
|
* Get the search instance.
|
||||||
*
|
|
||||||
* @return Search|null
|
|
||||||
*/
|
*/
|
||||||
protected function getSearch(): ?Search
|
protected function getSearch(): ?Search
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -13,18 +13,11 @@ use Illuminate\Support\Facades\DB;
|
|||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class DestroyTrackAction.
|
|
||||||
*/
|
|
||||||
class DestroyTrackAction
|
class DestroyTrackAction
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Destroy playlist track.
|
* Destroy playlist track.
|
||||||
*
|
*
|
||||||
* @param Playlist $playlist
|
|
||||||
* @param PlaylistTrack $track
|
|
||||||
* @return string
|
|
||||||
*
|
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function destroy(Playlist $playlist, PlaylistTrack $track): string
|
public function destroy(Playlist $playlist, PlaylistTrack $track): string
|
||||||
|
|||||||
@@ -17,18 +17,12 @@ use Illuminate\Support\Arr;
|
|||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class StoreTrackAction.
|
|
||||||
*/
|
|
||||||
class StoreTrackAction
|
class StoreTrackAction
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Store playlist track.
|
* Store playlist track.
|
||||||
*
|
*
|
||||||
* @param Playlist $playlist
|
|
||||||
* @param Builder $builder
|
|
||||||
* @param array $parameters
|
* @param array $parameters
|
||||||
* @return PlaylistTrack
|
|
||||||
*
|
*
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -16,18 +16,12 @@ use Illuminate\Support\Arr;
|
|||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class UpdateTrackAction.
|
|
||||||
*/
|
|
||||||
class UpdateTrackAction
|
class UpdateTrackAction
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Store playlist track.
|
* Store playlist track.
|
||||||
*
|
*
|
||||||
* @param Playlist $playlist
|
|
||||||
* @param PlaylistTrack $track
|
|
||||||
* @param array $parameters
|
* @param array $parameters
|
||||||
* @return PlaylistTrack
|
|
||||||
*
|
*
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -7,16 +7,10 @@ namespace App\Actions\Http\Api;
|
|||||||
use App\Contracts\Models\SoftDeletable;
|
use App\Contracts\Models\SoftDeletable;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class RestoreAction.
|
|
||||||
*/
|
|
||||||
class RestoreAction
|
class RestoreAction
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Restore model.
|
* Restore model.
|
||||||
*
|
|
||||||
* @param Model&SoftDeletable $model
|
|
||||||
* @return Model&SoftDeletable
|
|
||||||
*/
|
*/
|
||||||
public function restore(Model&SoftDeletable $model): Model&SoftDeletable
|
public function restore(Model&SoftDeletable $model): Model&SoftDeletable
|
||||||
{
|
{
|
||||||
@@ -27,9 +21,6 @@ class RestoreAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Perform model cleanup for presentation.
|
* Perform model cleanup for presentation.
|
||||||
*
|
|
||||||
* @param Model&SoftDeletable $model
|
|
||||||
* @return Model&SoftDeletable
|
|
||||||
*/
|
*/
|
||||||
public function cleanup(Model&SoftDeletable $model): Model&SoftDeletable
|
public function cleanup(Model&SoftDeletable $model): Model&SoftDeletable
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,20 +9,12 @@ use App\Http\Api\Query\Query;
|
|||||||
use App\Http\Api\Schema\Schema;
|
use App\Http\Api\Schema\Schema;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class ShowAction.
|
|
||||||
*/
|
|
||||||
class ShowAction
|
class ShowAction
|
||||||
{
|
{
|
||||||
use ConstrainsEagerLoads;
|
use ConstrainsEagerLoads;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show model.
|
* Show model.
|
||||||
*
|
|
||||||
* @param Model $model
|
|
||||||
* @param Query $query
|
|
||||||
* @param Schema $schema
|
|
||||||
* @return Model
|
|
||||||
*/
|
*/
|
||||||
public function show(Model $model, Query $query, Schema $schema): Model
|
public function show(Model $model, Query $query, Schema $schema): Model
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ class StoreImageAction extends StoreAction
|
|||||||
*
|
*
|
||||||
* @param Builder<Image> $builder
|
* @param Builder<Image> $builder
|
||||||
* @param array $parameters
|
* @param array $parameters
|
||||||
* @return Image
|
|
||||||
*/
|
*/
|
||||||
public function store(Builder $builder, array $parameters): Image
|
public function store(Builder $builder, array $parameters): Image
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -18,16 +18,12 @@ use Symfony\Component\HttpFoundation\StreamedResponse;
|
|||||||
abstract class DownloadAction implements InteractsWithDisk
|
abstract class DownloadAction implements InteractsWithDisk
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Create a new action instance.
|
|
||||||
*
|
|
||||||
* @param TModel $model
|
* @param TModel $model
|
||||||
*/
|
*/
|
||||||
public function __construct(protected readonly BaseModel $model) {}
|
public function __construct(protected readonly BaseModel $model) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Download the resource.
|
* Download the resource.
|
||||||
*
|
|
||||||
* @return StreamedResponse
|
|
||||||
*/
|
*/
|
||||||
public function download(): StreamedResponse
|
public function download(): StreamedResponse
|
||||||
{
|
{
|
||||||
@@ -39,8 +35,6 @@ abstract class DownloadAction implements InteractsWithDisk
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the path of the resource in storage.
|
* Get the path of the resource in storage.
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
abstract protected function path(): string;
|
abstract protected function path(): string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,16 +8,10 @@ use Illuminate\Filesystem\FilesystemAdapter;
|
|||||||
use Illuminate\Http\Response;
|
use Illuminate\Http\Response;
|
||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class NginxStreamAction.
|
|
||||||
*/
|
|
||||||
abstract class NginxStreamAction extends StreamAction
|
abstract class NginxStreamAction extends StreamAction
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Stream the resource.
|
* Stream the resource.
|
||||||
*
|
|
||||||
* @param string $disposition
|
|
||||||
* @return Response
|
|
||||||
*/
|
*/
|
||||||
public function stream(string $disposition = 'inline'): Response
|
public function stream(string $disposition = 'inline'): Response
|
||||||
{
|
{
|
||||||
@@ -48,8 +42,6 @@ abstract class NginxStreamAction extends StreamAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the location of the nginx internal redirect.
|
* Get the location of the nginx internal redirect.
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
abstract protected function nginxRedirect(): string;
|
abstract protected function nginxRedirect(): string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,16 +7,10 @@ namespace App\Actions\Http;
|
|||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
use Symfony\Component\HttpFoundation\StreamedResponse;
|
use Symfony\Component\HttpFoundation\StreamedResponse;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class ResponseStreamAction.
|
|
||||||
*/
|
|
||||||
abstract class ResponseStreamAction extends StreamAction
|
abstract class ResponseStreamAction extends StreamAction
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Stream the resource.
|
* Stream the resource.
|
||||||
*
|
|
||||||
* @param string $disposition
|
|
||||||
* @return StreamedResponse
|
|
||||||
*/
|
*/
|
||||||
public function stream(string $disposition = 'inline'): StreamedResponse
|
public function stream(string $disposition = 'inline'): StreamedResponse
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,23 +8,12 @@ use App\Contracts\Models\Streamable;
|
|||||||
use App\Contracts\Storage\InteractsWithDisk;
|
use App\Contracts\Storage\InteractsWithDisk;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class StreamAction.
|
|
||||||
*/
|
|
||||||
abstract class StreamAction implements InteractsWithDisk
|
abstract class StreamAction implements InteractsWithDisk
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Create a new action instance.
|
|
||||||
*
|
|
||||||
* @param Streamable $streamable
|
|
||||||
*/
|
|
||||||
public function __construct(protected readonly Streamable $streamable) {}
|
public function __construct(protected readonly Streamable $streamable) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stream the resource.
|
* Stream the resource.
|
||||||
*
|
|
||||||
* @param string $disposition
|
|
||||||
* @return Response
|
|
||||||
*/
|
*/
|
||||||
abstract public function stream(string $disposition = 'inline'): Response;
|
abstract public function stream(string $disposition = 'inline'): Response;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,16 +9,8 @@ use App\Constants\Config\AudioConstants;
|
|||||||
use App\Models\Wiki\Audio;
|
use App\Models\Wiki\Audio;
|
||||||
use Illuminate\Support\Facades\Config;
|
use Illuminate\Support\Facades\Config;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class AudioNginxStreamAction.
|
|
||||||
*/
|
|
||||||
class AudioNginxStreamAction extends NginxStreamAction
|
class AudioNginxStreamAction extends NginxStreamAction
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Create a new action instance.
|
|
||||||
*
|
|
||||||
* @param Audio $audio
|
|
||||||
*/
|
|
||||||
public function __construct(Audio $audio)
|
public function __construct(Audio $audio)
|
||||||
{
|
{
|
||||||
parent::__construct($audio);
|
parent::__construct($audio);
|
||||||
@@ -26,8 +18,6 @@ class AudioNginxStreamAction extends NginxStreamAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The name of the disk.
|
* The name of the disk.
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
public function disk(): string
|
public function disk(): string
|
||||||
{
|
{
|
||||||
@@ -36,8 +26,6 @@ class AudioNginxStreamAction extends NginxStreamAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the location of the nginx internal redirect.
|
* Get the location of the nginx internal redirect.
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
protected function nginxRedirect(): string
|
protected function nginxRedirect(): string
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,16 +9,8 @@ use App\Constants\Config\AudioConstants;
|
|||||||
use App\Models\Wiki\Audio;
|
use App\Models\Wiki\Audio;
|
||||||
use Illuminate\Support\Facades\Config;
|
use Illuminate\Support\Facades\Config;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class AudioResponseStreamAction.
|
|
||||||
*/
|
|
||||||
class AudioResponseStreamAction extends ResponseStreamAction
|
class AudioResponseStreamAction extends ResponseStreamAction
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Create a new action instance.
|
|
||||||
*
|
|
||||||
* @param Audio $audio
|
|
||||||
*/
|
|
||||||
public function __construct(Audio $audio)
|
public function __construct(Audio $audio)
|
||||||
{
|
{
|
||||||
parent::__construct($audio);
|
parent::__construct($audio);
|
||||||
@@ -26,8 +18,6 @@ class AudioResponseStreamAction extends ResponseStreamAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The name of the disk.
|
* The name of the disk.
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
public function disk(): string
|
public function disk(): string
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -16,11 +16,6 @@ use Illuminate\Support\Facades\Config;
|
|||||||
*/
|
*/
|
||||||
class ScriptDownloadAction extends DownloadAction
|
class ScriptDownloadAction extends DownloadAction
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Create a new action instance.
|
|
||||||
*
|
|
||||||
* @param VideoScript $script
|
|
||||||
*/
|
|
||||||
public function __construct(VideoScript $script)
|
public function __construct(VideoScript $script)
|
||||||
{
|
{
|
||||||
parent::__construct($script);
|
parent::__construct($script);
|
||||||
@@ -28,8 +23,6 @@ class ScriptDownloadAction extends DownloadAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the path of the resource in storage.
|
* Get the path of the resource in storage.
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
protected function path(): string
|
protected function path(): string
|
||||||
{
|
{
|
||||||
@@ -38,8 +31,6 @@ class ScriptDownloadAction extends DownloadAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The name of the disk.
|
* The name of the disk.
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
public function disk(): string
|
public function disk(): string
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,16 +9,8 @@ use App\Constants\Config\VideoConstants;
|
|||||||
use App\Models\Wiki\Video;
|
use App\Models\Wiki\Video;
|
||||||
use Illuminate\Support\Facades\Config;
|
use Illuminate\Support\Facades\Config;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class VideoNginxStreamAction.
|
|
||||||
*/
|
|
||||||
class VideoNginxStreamAction extends NginxStreamAction
|
class VideoNginxStreamAction extends NginxStreamAction
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Create a new action instance.
|
|
||||||
*
|
|
||||||
* @param Video $video
|
|
||||||
*/
|
|
||||||
public function __construct(Video $video)
|
public function __construct(Video $video)
|
||||||
{
|
{
|
||||||
parent::__construct($video);
|
parent::__construct($video);
|
||||||
@@ -26,8 +18,6 @@ class VideoNginxStreamAction extends NginxStreamAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The name of the disk.
|
* The name of the disk.
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
public function disk(): string
|
public function disk(): string
|
||||||
{
|
{
|
||||||
@@ -36,8 +26,6 @@ class VideoNginxStreamAction extends NginxStreamAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the location of the nginx internal redirect.
|
* Get the location of the nginx internal redirect.
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
protected function nginxRedirect(): string
|
protected function nginxRedirect(): string
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,16 +9,8 @@ use App\Constants\Config\VideoConstants;
|
|||||||
use App\Models\Wiki\Video;
|
use App\Models\Wiki\Video;
|
||||||
use Illuminate\Support\Facades\Config;
|
use Illuminate\Support\Facades\Config;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class VideoResponseStreamAction.
|
|
||||||
*/
|
|
||||||
class VideoResponseStreamAction extends ResponseStreamAction
|
class VideoResponseStreamAction extends ResponseStreamAction
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Create a new action instance.
|
|
||||||
*
|
|
||||||
* @param Video $video
|
|
||||||
*/
|
|
||||||
public function __construct(Video $video)
|
public function __construct(Video $video)
|
||||||
{
|
{
|
||||||
parent::__construct($video);
|
parent::__construct($video);
|
||||||
@@ -26,8 +18,6 @@ class VideoResponseStreamAction extends ResponseStreamAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The name of the disk.
|
* The name of the disk.
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
public function disk(): string
|
public function disk(): string
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,16 +9,11 @@ use App\Enums\Actions\ActionStatus;
|
|||||||
use Exception;
|
use Exception;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class SyncLikeAggregatesAction.
|
|
||||||
*/
|
|
||||||
class SyncLikeAggregatesAction
|
class SyncLikeAggregatesAction
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Handles the action.
|
* Handles the action.
|
||||||
*
|
*
|
||||||
* @return ActionResult
|
|
||||||
*
|
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function handle(): ActionResult
|
public function handle(): ActionResult
|
||||||
|
|||||||
@@ -9,16 +9,11 @@ use App\Enums\Actions\ActionStatus;
|
|||||||
use Exception;
|
use Exception;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class SyncViewAggregatesAction.
|
|
||||||
*/
|
|
||||||
class SyncViewAggregatesAction
|
class SyncViewAggregatesAction
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Handles the action.
|
* Handles the action.
|
||||||
*
|
*
|
||||||
* @return ActionResult
|
|
||||||
*
|
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function handle(): ActionResult
|
public function handle(): ActionResult
|
||||||
|
|||||||
@@ -8,17 +8,10 @@ use App\Contracts\Models\HasHashids;
|
|||||||
use App\Models\BaseModel;
|
use App\Models\BaseModel;
|
||||||
use Vinkla\Hashids\Facades\Hashids;
|
use Vinkla\Hashids\Facades\Hashids;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class AssignHashidsAction.
|
|
||||||
*/
|
|
||||||
class AssignHashidsAction
|
class AssignHashidsAction
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Assign Hashids to model.
|
* Assign Hashids to model.
|
||||||
*
|
|
||||||
* @param HasHashids&BaseModel $model
|
|
||||||
* @param string|null $connection
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function assign(HasHashids&BaseModel $model, ?string $connection = null): void
|
public function assign(HasHashids&BaseModel $model, ?string $connection = null): void
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -17,16 +17,12 @@ use Illuminate\Support\Str;
|
|||||||
abstract class BackfillAction
|
abstract class BackfillAction
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Create a new action instance.
|
|
||||||
*
|
|
||||||
* @param TModel $model
|
* @param TModel $model
|
||||||
*/
|
*/
|
||||||
public function __construct(protected BaseModel $model) {}
|
public function __construct(protected BaseModel $model) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle action.
|
* Handle action.
|
||||||
*
|
|
||||||
* @return ActionResult
|
|
||||||
*/
|
*/
|
||||||
abstract public function handle(): ActionResult;
|
abstract public function handle(): ActionResult;
|
||||||
|
|
||||||
@@ -39,15 +35,11 @@ abstract class BackfillAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the relation to resources.
|
* Get the relation to resources.
|
||||||
*
|
|
||||||
* @return Relation
|
|
||||||
*/
|
*/
|
||||||
abstract protected function relation(): Relation;
|
abstract protected function relation(): Relation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the human-friendly label for the underlying model.
|
* Get the human-friendly label for the underlying model.
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
protected function label(): string
|
protected function label(): string
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -19,9 +19,6 @@ use Illuminate\Support\Facades\Log;
|
|||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
use Illuminate\Support\Uri;
|
use Illuminate\Support\Uri;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class BackfillWikiAction.
|
|
||||||
*/
|
|
||||||
abstract class BackfillWikiAction
|
abstract class BackfillWikiAction
|
||||||
{
|
{
|
||||||
use CanCreateExternalResource;
|
use CanCreateExternalResource;
|
||||||
@@ -31,32 +28,24 @@ abstract class BackfillWikiAction
|
|||||||
final public const IMAGES = 'images';
|
final public const IMAGES = 'images';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new action instance.
|
|
||||||
*
|
|
||||||
* @param BaseModel $model
|
|
||||||
* @param array $toBackfill
|
* @param array $toBackfill
|
||||||
*/
|
*/
|
||||||
public function __construct(protected BaseModel $model, protected array $toBackfill) {}
|
public function __construct(protected BaseModel $model, protected array $toBackfill) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle the action.
|
* Handle the action.
|
||||||
*
|
|
||||||
* @return ActionResult
|
|
||||||
*/
|
*/
|
||||||
abstract public function handle(): ActionResult;
|
abstract public function handle(): ActionResult;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the external API actions available for the backfill action.
|
* Get the external API actions available for the backfill action.
|
||||||
*
|
*
|
||||||
* @return array<ExternalApiAction>
|
* @return ExternalApiAction[]
|
||||||
*/
|
*/
|
||||||
abstract protected function getExternalApiActions(): array;
|
abstract protected function getExternalApiActions(): array;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the resources given the response.
|
* Create the resources given the response.
|
||||||
*
|
|
||||||
* @param ExternalApiAction $api
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
protected function forResources(ExternalApiAction $api): void
|
protected function forResources(ExternalApiAction $api): void
|
||||||
{
|
{
|
||||||
@@ -83,9 +72,6 @@ abstract class BackfillWikiAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the images given the response.
|
* Create the images given the response.
|
||||||
*
|
|
||||||
* @param ExternalApiAction $api
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
protected function forImages(ExternalApiAction $api): void
|
protected function forImages(ExternalApiAction $api): void
|
||||||
{
|
{
|
||||||
@@ -112,10 +98,6 @@ abstract class BackfillWikiAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove element already backfilled.
|
* Remove element already backfilled.
|
||||||
*
|
|
||||||
* @param mixed $enum
|
|
||||||
* @param string $scope
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
protected function backfilled(mixed $enum, string $scope): void
|
protected function backfilled(mixed $enum, string $scope): void
|
||||||
{
|
{
|
||||||
@@ -135,8 +117,6 @@ abstract class BackfillWikiAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the human-friendly label for the underlying model.
|
* Get the human-friendly label for the underlying model.
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
protected function label(): string
|
protected function label(): string
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -24,22 +24,13 @@ abstract class BaseExternalEntryClaimedAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The id of the external user.
|
* The id of the external user.
|
||||||
*
|
|
||||||
* @var int|null
|
|
||||||
*/
|
*/
|
||||||
protected ?int $userId = null;
|
protected ?int $userId = null;
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new action instance.
|
|
||||||
*
|
|
||||||
* @param ExternalToken $token
|
|
||||||
*/
|
|
||||||
public function __construct(protected ExternalToken $token) {}
|
public function __construct(protected ExternalToken $token) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the id of the external user.
|
* Get the id of the external user.
|
||||||
*
|
|
||||||
* @return int|null
|
|
||||||
*/
|
*/
|
||||||
public function getUserId(): ?int
|
public function getUserId(): ?int
|
||||||
{
|
{
|
||||||
@@ -48,8 +39,6 @@ abstract class BaseExternalEntryClaimedAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the token to the request.
|
* Get the token to the request.
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
protected function getToken(): string
|
protected function getToken(): string
|
||||||
{
|
{
|
||||||
@@ -58,8 +47,6 @@ abstract class BaseExternalEntryClaimedAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the username.
|
* Get the username.
|
||||||
*
|
|
||||||
* @return string|null
|
|
||||||
*/
|
*/
|
||||||
abstract public function getUsername(): ?string;
|
abstract public function getUsername(): ?string;
|
||||||
|
|
||||||
@@ -73,8 +60,6 @@ abstract class BaseExternalEntryClaimedAction
|
|||||||
/**
|
/**
|
||||||
* Make the request to the external api.
|
* Make the request to the external api.
|
||||||
*
|
*
|
||||||
* @return void
|
|
||||||
*
|
|
||||||
* @throws RequestException
|
* @throws RequestException
|
||||||
*/
|
*/
|
||||||
abstract protected function makeRequest(): void;
|
abstract protected function makeRequest(): void;
|
||||||
|
|||||||
@@ -23,16 +23,12 @@ abstract class BaseExternalEntryUnclaimedAction
|
|||||||
protected ?array $data = null;
|
protected ?array $data = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new action instance.
|
|
||||||
*
|
|
||||||
* @param ExternalProfile|array $profile
|
* @param ExternalProfile|array $profile
|
||||||
*/
|
*/
|
||||||
public function __construct(protected ExternalProfile|array $profile) {}
|
public function __construct(protected ExternalProfile|array $profile) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the username of the profile.
|
* Get the username of the profile.
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
public function getUsername(): string
|
public function getUsername(): string
|
||||||
{
|
{
|
||||||
@@ -45,8 +41,6 @@ abstract class BaseExternalEntryUnclaimedAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the id of the external user.
|
* Get the id of the external user.
|
||||||
*
|
|
||||||
* @return int|null
|
|
||||||
*/
|
*/
|
||||||
abstract public function getId(): ?int;
|
abstract public function getId(): ?int;
|
||||||
|
|
||||||
@@ -60,8 +54,6 @@ abstract class BaseExternalEntryUnclaimedAction
|
|||||||
/**
|
/**
|
||||||
* Make the request to the external api.
|
* Make the request to the external api.
|
||||||
*
|
*
|
||||||
* @return void
|
|
||||||
*
|
|
||||||
* @throws RequestException
|
* @throws RequestException
|
||||||
*/
|
*/
|
||||||
abstract protected function makeRequest(): void;
|
abstract protected function makeRequest(): void;
|
||||||
|
|||||||
-9
@@ -13,9 +13,6 @@ use Illuminate\Support\Arr;
|
|||||||
use Illuminate\Support\Facades\Http;
|
use Illuminate\Support\Facades\Http;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class AnilistExternalEntryClaimedAction.
|
|
||||||
*/
|
|
||||||
class AnilistExternalEntryClaimedAction extends BaseExternalEntryClaimedAction
|
class AnilistExternalEntryClaimedAction extends BaseExternalEntryClaimedAction
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@@ -52,8 +49,6 @@ class AnilistExternalEntryClaimedAction extends BaseExternalEntryClaimedAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the username.
|
* Get the username.
|
||||||
*
|
|
||||||
* @return string|null
|
|
||||||
*/
|
*/
|
||||||
public function getUsername(): ?string
|
public function getUsername(): ?string
|
||||||
{
|
{
|
||||||
@@ -66,8 +61,6 @@ class AnilistExternalEntryClaimedAction extends BaseExternalEntryClaimedAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the id of the external user.
|
* Get the id of the external user.
|
||||||
*
|
|
||||||
* @return int|null
|
|
||||||
*/
|
*/
|
||||||
public function getUserId(): ?int
|
public function getUserId(): ?int
|
||||||
{
|
{
|
||||||
@@ -87,8 +80,6 @@ class AnilistExternalEntryClaimedAction extends BaseExternalEntryClaimedAction
|
|||||||
/**
|
/**
|
||||||
* Make the request to the external api.
|
* Make the request to the external api.
|
||||||
*
|
*
|
||||||
* @return void
|
|
||||||
*
|
|
||||||
* @throws RequestException
|
* @throws RequestException
|
||||||
*/
|
*/
|
||||||
protected function makeRequest(): void
|
protected function makeRequest(): void
|
||||||
|
|||||||
-11
@@ -15,9 +15,6 @@ use Illuminate\Support\Facades\Http;
|
|||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
use Illuminate\Support\Facades\RateLimiter;
|
use Illuminate\Support\Facades\RateLimiter;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class MalExternalEntryClaimedAction.
|
|
||||||
*/
|
|
||||||
class MalExternalEntryClaimedAction extends BaseExternalEntryClaimedAction
|
class MalExternalEntryClaimedAction extends BaseExternalEntryClaimedAction
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@@ -63,8 +60,6 @@ class MalExternalEntryClaimedAction extends BaseExternalEntryClaimedAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the username.
|
* Get the username.
|
||||||
*
|
|
||||||
* @return string|null
|
|
||||||
*/
|
*/
|
||||||
public function getUsername(): ?string
|
public function getUsername(): ?string
|
||||||
{
|
{
|
||||||
@@ -77,8 +72,6 @@ class MalExternalEntryClaimedAction extends BaseExternalEntryClaimedAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the id of the external user.
|
* Get the id of the external user.
|
||||||
*
|
|
||||||
* @return int|null
|
|
||||||
*/
|
*/
|
||||||
public function getUserId(): ?int
|
public function getUserId(): ?int
|
||||||
{
|
{
|
||||||
@@ -92,8 +85,6 @@ class MalExternalEntryClaimedAction extends BaseExternalEntryClaimedAction
|
|||||||
/**
|
/**
|
||||||
* Make the request to the user endpoint of the external api.
|
* Make the request to the user endpoint of the external api.
|
||||||
*
|
*
|
||||||
* @return void
|
|
||||||
*
|
|
||||||
* @throws RequestException
|
* @throws RequestException
|
||||||
*/
|
*/
|
||||||
protected function makeUserRequest(): void
|
protected function makeUserRequest(): void
|
||||||
@@ -113,8 +104,6 @@ class MalExternalEntryClaimedAction extends BaseExternalEntryClaimedAction
|
|||||||
/**
|
/**
|
||||||
* Make the request to the external api.
|
* Make the request to the external api.
|
||||||
*
|
*
|
||||||
* @return void
|
|
||||||
*
|
|
||||||
* @throws RequestException
|
* @throws RequestException
|
||||||
*/
|
*/
|
||||||
protected function makeRequest(): void
|
protected function makeRequest(): void
|
||||||
|
|||||||
-7
@@ -13,9 +13,6 @@ use Illuminate\Support\Arr;
|
|||||||
use Illuminate\Support\Facades\Http;
|
use Illuminate\Support\Facades\Http;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class AnilistExternalEntryUnclaimedAction.
|
|
||||||
*/
|
|
||||||
class AnilistExternalEntryUnclaimedAction extends BaseExternalEntryUnclaimedAction
|
class AnilistExternalEntryUnclaimedAction extends BaseExternalEntryUnclaimedAction
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@@ -51,8 +48,6 @@ class AnilistExternalEntryUnclaimedAction extends BaseExternalEntryUnclaimedActi
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the id of the external user.
|
* Get the id of the external user.
|
||||||
*
|
|
||||||
* @return int|null
|
|
||||||
*/
|
*/
|
||||||
public function getId(): ?int
|
public function getId(): ?int
|
||||||
{
|
{
|
||||||
@@ -66,8 +61,6 @@ class AnilistExternalEntryUnclaimedAction extends BaseExternalEntryUnclaimedActi
|
|||||||
/**
|
/**
|
||||||
* Make the request to the external api.
|
* Make the request to the external api.
|
||||||
*
|
*
|
||||||
* @return void
|
|
||||||
*
|
|
||||||
* @throws RequestException
|
* @throws RequestException
|
||||||
*/
|
*/
|
||||||
protected function makeRequest(): void
|
protected function makeRequest(): void
|
||||||
|
|||||||
@@ -18,9 +18,6 @@ use Illuminate\Support\Collection;
|
|||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
use RuntimeException;
|
use RuntimeException;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class StoreExternalProfileClaimedAction.
|
|
||||||
*/
|
|
||||||
class StoreExternalProfileClaimedAction
|
class StoreExternalProfileClaimedAction
|
||||||
{
|
{
|
||||||
protected Collection $resources;
|
protected Collection $resources;
|
||||||
@@ -28,9 +25,7 @@ class StoreExternalProfileClaimedAction
|
|||||||
/**
|
/**
|
||||||
* Get the first record or store external profile given determined external token.
|
* Get the first record or store external profile given determined external token.
|
||||||
*
|
*
|
||||||
* @param ExternalToken $token
|
|
||||||
* @param array $parameters
|
* @param array $parameters
|
||||||
* @return ExternalProfile
|
|
||||||
*
|
*
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
@@ -56,11 +51,7 @@ class StoreExternalProfileClaimedAction
|
|||||||
/**
|
/**
|
||||||
* Get the first record or create the profile for a userId and site.
|
* Get the first record or create the profile for a userId and site.
|
||||||
*
|
*
|
||||||
* @param int $userId
|
|
||||||
* @param ExternalProfileSite $site
|
|
||||||
* @param BaseExternalEntryClaimedAction $action
|
|
||||||
* @param array $parameters
|
* @param array $parameters
|
||||||
* @return ExternalProfile
|
|
||||||
*/
|
*/
|
||||||
protected function firstForUserIdOrCreate(int $userId, ExternalProfileSite $site, BaseExternalEntryClaimedAction $action, array $parameters): ExternalProfile
|
protected function firstForUserIdOrCreate(int $userId, ExternalProfileSite $site, BaseExternalEntryClaimedAction $action, array $parameters): ExternalProfile
|
||||||
{
|
{
|
||||||
@@ -108,10 +99,6 @@ class StoreExternalProfileClaimedAction
|
|||||||
/**
|
/**
|
||||||
* Get the mapping for the entries token class.
|
* Get the mapping for the entries token class.
|
||||||
*
|
*
|
||||||
* @param ExternalProfileSite $site
|
|
||||||
* @param ExternalToken $token
|
|
||||||
* @return BaseExternalEntryClaimedAction
|
|
||||||
*
|
|
||||||
* @throws RuntimeException
|
* @throws RuntimeException
|
||||||
*/
|
*/
|
||||||
public static function getActionClass(ExternalProfileSite $site, ExternalToken $token): BaseExternalEntryClaimedAction
|
public static function getActionClass(ExternalProfileSite $site, ExternalToken $token): BaseExternalEntryClaimedAction
|
||||||
|
|||||||
@@ -17,17 +17,12 @@ use Illuminate\Support\Facades\DB;
|
|||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
use RuntimeException;
|
use RuntimeException;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class StoreExternalProfileUnclaimedAction.
|
|
||||||
*/
|
|
||||||
class StoreExternalProfileUnclaimedAction
|
class StoreExternalProfileUnclaimedAction
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Get the first record or store an external profile and its entries given determined username.
|
* Get the first record or store an external profile and its entries given determined username.
|
||||||
*
|
*
|
||||||
* @param Builder $builder
|
|
||||||
* @param array $profileParameters
|
* @param array $profileParameters
|
||||||
* @return ExternalProfile
|
|
||||||
*
|
*
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
@@ -84,9 +79,7 @@ class StoreExternalProfileUnclaimedAction
|
|||||||
/**
|
/**
|
||||||
* Get the mapping for the entries class.
|
* Get the mapping for the entries class.
|
||||||
*
|
*
|
||||||
* @param ExternalProfileSite $site
|
|
||||||
* @param ExternalProfile|array $profile
|
* @param ExternalProfile|array $profile
|
||||||
* @return BaseExternalEntryUnclaimedAction
|
|
||||||
*
|
*
|
||||||
* @throws RuntimeException
|
* @throws RuntimeException
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -19,9 +19,6 @@ use Illuminate\Support\Facades\Cache;
|
|||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class SyncExternalProfileAction.
|
|
||||||
*/
|
|
||||||
class SyncExternalProfileAction
|
class SyncExternalProfileAction
|
||||||
{
|
{
|
||||||
protected Collection $resources;
|
protected Collection $resources;
|
||||||
@@ -29,9 +26,6 @@ class SyncExternalProfileAction
|
|||||||
/**
|
/**
|
||||||
* Sync the profile.
|
* Sync the profile.
|
||||||
*
|
*
|
||||||
* @param ExternalProfile $profile
|
|
||||||
* @return ExternalProfile
|
|
||||||
*
|
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function handle(ExternalProfile $profile): ExternalProfile
|
public function handle(ExternalProfile $profile): ExternalProfile
|
||||||
@@ -95,9 +89,6 @@ class SyncExternalProfileAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the mapping for the entries token class.
|
* Get the mapping for the entries token class.
|
||||||
*
|
|
||||||
* @param ExternalProfile $profile
|
|
||||||
* @return BaseExternalEntryClaimedAction
|
|
||||||
*/
|
*/
|
||||||
protected function getClaimedActionClass(ExternalProfile $profile): BaseExternalEntryClaimedAction
|
protected function getClaimedActionClass(ExternalProfile $profile): BaseExternalEntryClaimedAction
|
||||||
{
|
{
|
||||||
@@ -106,9 +97,6 @@ class SyncExternalProfileAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the mapping for the entries class.
|
* Get the mapping for the entries class.
|
||||||
*
|
|
||||||
* @param ExternalProfile $profile
|
|
||||||
* @return BaseExternalEntryUnclaimedAction
|
|
||||||
*/
|
*/
|
||||||
protected function getUnclaimedActionClass(ExternalProfile $profile): BaseExternalEntryUnclaimedAction
|
protected function getUnclaimedActionClass(ExternalProfile $profile): BaseExternalEntryUnclaimedAction
|
||||||
{
|
{
|
||||||
@@ -117,9 +105,6 @@ class SyncExternalProfileAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Cache the resources for performance proposals.
|
* Cache the resources for performance proposals.
|
||||||
*
|
|
||||||
* @param ExternalProfileSite $profileSite
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
protected function cacheResources(ExternalProfileSite $profileSite): void
|
protected function cacheResources(ExternalProfileSite $profileSite): void
|
||||||
{
|
{
|
||||||
@@ -137,7 +122,6 @@ class SyncExternalProfileAction
|
|||||||
/**
|
/**
|
||||||
* Get the animes by the external id.
|
* Get the animes by the external id.
|
||||||
*
|
*
|
||||||
* @param int $externalId
|
|
||||||
* @return Collection<int, int>
|
* @return Collection<int, int>
|
||||||
*/
|
*/
|
||||||
protected function getAnimesByExternalId(int $externalId): Collection
|
protected function getAnimesByExternalId(int $externalId): Collection
|
||||||
|
|||||||
@@ -7,16 +7,12 @@ namespace App\Actions\Models\List\External\Token;
|
|||||||
use App\Models\List\External\ExternalToken;
|
use App\Models\List\External\ExternalToken;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class BaseExternalTokenAction.
|
|
||||||
*/
|
|
||||||
abstract class BaseExternalTokenAction
|
abstract class BaseExternalTokenAction
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Use the authorization code to get the tokens and store them.
|
* Use the authorization code to get the tokens and store them.
|
||||||
*
|
*
|
||||||
* @param array $parameters
|
* @param array $parameters
|
||||||
* @return ExternalToken
|
|
||||||
*
|
*
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -14,16 +14,12 @@ use Illuminate\Support\Facades\Crypt;
|
|||||||
use Illuminate\Support\Facades\Http;
|
use Illuminate\Support\Facades\Http;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class AnilistExternalTokenAction.
|
|
||||||
*/
|
|
||||||
class AnilistExternalTokenAction extends BaseExternalTokenAction
|
class AnilistExternalTokenAction extends BaseExternalTokenAction
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Use the authorization code to get the tokens and store them.
|
* Use the authorization code to get the tokens and store them.
|
||||||
*
|
*
|
||||||
* @param array $parameters
|
* @param array $parameters
|
||||||
* @return ExternalToken
|
|
||||||
*
|
*
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ class MalExternalTokenAction extends BaseExternalTokenAction
|
|||||||
* Use the authorization code to get the tokens and store them.
|
* Use the authorization code to get the tokens and store them.
|
||||||
*
|
*
|
||||||
* @param array $parameters
|
* @param array $parameters
|
||||||
* @return ExternalToken
|
|
||||||
*
|
*
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -18,16 +18,12 @@ use Illuminate\Support\Facades\DB;
|
|||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
use RuntimeException;
|
use RuntimeException;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class ExternalTokenCallbackAction.
|
|
||||||
*/
|
|
||||||
class ExternalTokenCallbackAction
|
class ExternalTokenCallbackAction
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* We should store the token and the profile.
|
* We should store the token and the profile.
|
||||||
*
|
*
|
||||||
* @param array $parameters
|
* @param array $parameters
|
||||||
* @return ExternalProfile
|
|
||||||
*
|
*
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
@@ -69,9 +65,6 @@ class ExternalTokenCallbackAction
|
|||||||
/**
|
/**
|
||||||
* Get the mapping for the token class.
|
* Get the mapping for the token class.
|
||||||
*
|
*
|
||||||
* @param ExternalProfileSite $site
|
|
||||||
* @return BaseExternalTokenAction
|
|
||||||
*
|
|
||||||
* @throws RuntimeException
|
* @throws RuntimeException
|
||||||
*/
|
*/
|
||||||
protected function getActionClass(ExternalProfileSite $site): BaseExternalTokenAction
|
protected function getActionClass(ExternalProfileSite $site): BaseExternalTokenAction
|
||||||
|
|||||||
@@ -11,17 +11,10 @@ use Illuminate\Support\Collection;
|
|||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class FixPlaylistAction.
|
|
||||||
*/
|
|
||||||
class FixPlaylistAction
|
class FixPlaylistAction
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Handle the action.
|
* Handle the action.
|
||||||
*
|
|
||||||
* @param Playlist $playlist,
|
|
||||||
* @param mixed $context
|
|
||||||
* @return int
|
|
||||||
*/
|
*/
|
||||||
public function handle(Playlist $playlist, mixed $context = null): int
|
public function handle(Playlist $playlist, mixed $context = null): int
|
||||||
{
|
{
|
||||||
@@ -114,11 +107,6 @@ class FixPlaylistAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Send the message given the context.
|
* Send the message given the context.
|
||||||
*
|
|
||||||
* @param string $message
|
|
||||||
* @param mixed $context
|
|
||||||
* @param string $type
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
protected function sendMessage(string $message, mixed $context, string $type): void
|
protected function sendMessage(string $message, mixed $context, string $type): void
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,18 +10,11 @@ use Exception;
|
|||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class InsertTrackAction.
|
|
||||||
*/
|
|
||||||
class InsertTrackAction
|
class InsertTrackAction
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Append track to playlist.
|
* Append track to playlist.
|
||||||
*
|
*
|
||||||
* @param Playlist $playlist
|
|
||||||
* @param PlaylistTrack $track
|
|
||||||
* @return void
|
|
||||||
*
|
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function insert(Playlist $playlist, PlaylistTrack $track): void
|
public function insert(Playlist $playlist, PlaylistTrack $track): void
|
||||||
|
|||||||
@@ -10,19 +10,11 @@ use Exception;
|
|||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class InsertTrackAfterAction.
|
|
||||||
*/
|
|
||||||
class InsertTrackAfterAction
|
class InsertTrackAfterAction
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Insert track after previous track.
|
* Insert track after previous track.
|
||||||
*
|
*
|
||||||
* @param Playlist $playlist
|
|
||||||
* @param PlaylistTrack $track
|
|
||||||
* @param PlaylistTrack $previous
|
|
||||||
* @return void
|
|
||||||
*
|
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function insertAfter(Playlist $playlist, PlaylistTrack $track, PlaylistTrack $previous): void
|
public function insertAfter(Playlist $playlist, PlaylistTrack $track, PlaylistTrack $previous): void
|
||||||
|
|||||||
@@ -10,19 +10,11 @@ use Exception;
|
|||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class InsertTrackBeforeAction.
|
|
||||||
*/
|
|
||||||
class InsertTrackBeforeAction
|
class InsertTrackBeforeAction
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Insert track before next track.
|
* Insert track before next track.
|
||||||
*
|
*
|
||||||
* @param Playlist $playlist
|
|
||||||
* @param PlaylistTrack $track
|
|
||||||
* @param PlaylistTrack $next
|
|
||||||
* @return void
|
|
||||||
*
|
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function insertBefore(Playlist $playlist, PlaylistTrack $track, PlaylistTrack $next): void
|
public function insertBefore(Playlist $playlist, PlaylistTrack $track, PlaylistTrack $next): void
|
||||||
|
|||||||
@@ -10,18 +10,11 @@ use Exception;
|
|||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class RemoveTrackAction.
|
|
||||||
*/
|
|
||||||
class RemoveTrackAction
|
class RemoveTrackAction
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Remove track from playlist.
|
* Remove track from playlist.
|
||||||
*
|
*
|
||||||
* @param Playlist $playlist
|
|
||||||
* @param PlaylistTrack $track
|
|
||||||
* @return void
|
|
||||||
*
|
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function remove(Playlist $playlist, PlaylistTrack $track): void
|
public function remove(Playlist $playlist, PlaylistTrack $track): void
|
||||||
|
|||||||
@@ -11,16 +11,10 @@ use Illuminate\Database\Eloquent\Model;
|
|||||||
use Illuminate\Database\Eloquent\Relations\Pivot;
|
use Illuminate\Database\Eloquent\Relations\Pivot;
|
||||||
use Illuminate\Support\Facades\Date;
|
use Illuminate\Support\Facades\Date;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class ManageStepAction.
|
|
||||||
*/
|
|
||||||
class ManageStepAction
|
class ManageStepAction
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Execute the action and approve the step.
|
* Execute the action and approve the step.
|
||||||
*
|
|
||||||
* @param ReportStep $step
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public static function approveStep(ReportStep $step): void
|
public static function approveStep(ReportStep $step): void
|
||||||
{
|
{
|
||||||
@@ -36,9 +30,6 @@ class ManageStepAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the model according the step.
|
* Create the model according the step.
|
||||||
*
|
|
||||||
* @param ReportStep $step
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
protected static function approveCreate(ReportStep $step): void
|
protected static function approveCreate(ReportStep $step): void
|
||||||
{
|
{
|
||||||
@@ -52,9 +43,6 @@ class ManageStepAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete the model according the step.
|
* Delete the model according the step.
|
||||||
*
|
|
||||||
* @param ReportStep $step
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
protected static function approveDelete(ReportStep $step): void
|
protected static function approveDelete(ReportStep $step): void
|
||||||
{
|
{
|
||||||
@@ -65,9 +53,6 @@ class ManageStepAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the model according the step.
|
* Update the model according the step.
|
||||||
*
|
|
||||||
* @param ReportStep $step
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
protected static function approveUpdate(ReportStep $step): void
|
protected static function approveUpdate(ReportStep $step): void
|
||||||
{
|
{
|
||||||
@@ -78,9 +63,6 @@ class ManageStepAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Attach a model to another according the step.
|
* Attach a model to another according the step.
|
||||||
*
|
|
||||||
* @param ReportStep $step
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
protected static function approveAttach(ReportStep $step): void
|
protected static function approveAttach(ReportStep $step): void
|
||||||
{
|
{
|
||||||
@@ -94,9 +76,6 @@ class ManageStepAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Detach a model from another according the step.
|
* Detach a model from another according the step.
|
||||||
*
|
|
||||||
* @param ReportStep $step
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
protected static function approveDetach(ReportStep $step): void
|
protected static function approveDetach(ReportStep $step): void
|
||||||
{
|
{
|
||||||
@@ -110,9 +89,6 @@ class ManageStepAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Approve the step.
|
* Approve the step.
|
||||||
*
|
|
||||||
* @param ReportStep $step
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
protected static function markAsApproved(ReportStep $step): void
|
protected static function markAsApproved(ReportStep $step): void
|
||||||
{
|
{
|
||||||
@@ -121,9 +97,6 @@ class ManageStepAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reject the step.
|
* Reject the step.
|
||||||
*
|
|
||||||
* @param ReportStep $step
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
protected static function markAsRejected(ReportStep $step): void
|
protected static function markAsRejected(ReportStep $step): void
|
||||||
{
|
{
|
||||||
@@ -132,9 +105,6 @@ class ManageStepAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Approve partially the step.
|
* Approve partially the step.
|
||||||
*
|
|
||||||
* @param ReportStep $step
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
protected static function markAsPartiallyApproved(ReportStep $step): void
|
protected static function markAsPartiallyApproved(ReportStep $step): void
|
||||||
{
|
{
|
||||||
@@ -143,10 +113,6 @@ class ManageStepAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the status of the step.
|
* Update the status of the step.
|
||||||
*
|
|
||||||
* @param ReportStep $step
|
|
||||||
* @param ApprovableStatus $status
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
protected static function updateStatus(ReportStep $step, ApprovableStatus $status): void
|
protected static function updateStatus(ReportStep $step, ApprovableStatus $status): void
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -13,17 +13,12 @@ use Illuminate\Database\Eloquent\Relations\Pivot;
|
|||||||
use Illuminate\Support\Arr;
|
use Illuminate\Support\Arr;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class ReportAction.
|
|
||||||
*/
|
|
||||||
class ReportAction
|
class ReportAction
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Create a report with the given steps.
|
* Create a report with the given steps.
|
||||||
*
|
*
|
||||||
* @param ReportStep|ReportStep[] $steps
|
* @param ReportStep|ReportStep[] $steps
|
||||||
* @param string|null $notes
|
|
||||||
* @return Report
|
|
||||||
*/
|
*/
|
||||||
public static function makeReport(ReportStep|array $steps, ?string $notes = null): Report
|
public static function makeReport(ReportStep|array $steps, ?string $notes = null): Report
|
||||||
{
|
{
|
||||||
@@ -43,7 +38,6 @@ class ReportAction
|
|||||||
*
|
*
|
||||||
* @param class-string<Model> $model
|
* @param class-string<Model> $model
|
||||||
* @param array $fields
|
* @param array $fields
|
||||||
* @return ReportStep
|
|
||||||
*/
|
*/
|
||||||
public static function makeForCreate(string $model, array $fields): ReportStep
|
public static function makeForCreate(string $model, array $fields): ReportStep
|
||||||
{
|
{
|
||||||
@@ -53,9 +47,7 @@ class ReportAction
|
|||||||
/**
|
/**
|
||||||
* Create a report step to edit a model.
|
* Create a report step to edit a model.
|
||||||
*
|
*
|
||||||
* @param Model $model
|
|
||||||
* @param array $fields
|
* @param array $fields
|
||||||
* @return ReportStep
|
|
||||||
*/
|
*/
|
||||||
public static function makeForUpdate(Model $model, array $fields): ReportStep
|
public static function makeForUpdate(Model $model, array $fields): ReportStep
|
||||||
{
|
{
|
||||||
@@ -64,9 +56,6 @@ class ReportAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a report step to delete a model.
|
* Create a report step to delete a model.
|
||||||
*
|
|
||||||
* @param Model $model
|
|
||||||
* @return ReportStep
|
|
||||||
*/
|
*/
|
||||||
public static function makeForDelete(Model $model): ReportStep
|
public static function makeForDelete(Model $model): ReportStep
|
||||||
{
|
{
|
||||||
@@ -76,11 +65,8 @@ class ReportAction
|
|||||||
/**
|
/**
|
||||||
* Create a report step to attach a model to another in a many-to-many relationship.
|
* Create a report step to attach a model to another in a many-to-many relationship.
|
||||||
*
|
*
|
||||||
* @param Model $foreign
|
|
||||||
* @param Model $related
|
|
||||||
* @param class-string<Pivot> $pivot
|
* @param class-string<Pivot> $pivot
|
||||||
* @param array $fields
|
* @param array $fields
|
||||||
* @return ReportStep
|
|
||||||
*/
|
*/
|
||||||
public static function makeForAttach(Model $foreign, Model $related, string $pivot, array $fields): ReportStep
|
public static function makeForAttach(Model $foreign, Model $related, string $pivot, array $fields): ReportStep
|
||||||
{
|
{
|
||||||
@@ -90,11 +76,7 @@ class ReportAction
|
|||||||
/**
|
/**
|
||||||
* Create a report step to detach a model from another in a many-to-many relationship.
|
* Create a report step to detach a model from another in a many-to-many relationship.
|
||||||
*
|
*
|
||||||
* @param Model $foreign
|
|
||||||
* @param Model $related
|
|
||||||
* @param Pivot $pivot
|
|
||||||
* @param array $fields
|
* @param array $fields
|
||||||
* @return ReportStep
|
|
||||||
*/
|
*/
|
||||||
public static function makeForDetach(Model $foreign, Model $related, Pivot $pivot, array $fields): ReportStep
|
public static function makeForDetach(Model $foreign, Model $related, Pivot $pivot, array $fields): ReportStep
|
||||||
{
|
{
|
||||||
@@ -104,12 +86,8 @@ class ReportAction
|
|||||||
/**
|
/**
|
||||||
* Create a report step for given action.
|
* Create a report step for given action.
|
||||||
*
|
*
|
||||||
* @param ReportActionType $action
|
|
||||||
* @param class-string<Model>|Model $model
|
* @param class-string<Model>|Model $model
|
||||||
* @param array|null $fields
|
* @param array|null $fields
|
||||||
* @param Model|null $related
|
|
||||||
* @param Pivot|null $pivot
|
|
||||||
* @return ReportStep
|
|
||||||
*/
|
*/
|
||||||
protected static function makeFor(ReportActionType $action, Model|string $model, ?array $fields = null, ?Model $related = null, Pivot|string|null $pivot = null): ReportStep
|
protected static function makeFor(ReportActionType $action, Model|string $model, ?array $fields = null, ?Model $related = null, Pivot|string|null $pivot = null): ReportStep
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -17,15 +17,10 @@ use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
|||||||
use Illuminate\Support\Arr;
|
use Illuminate\Support\Arr;
|
||||||
use Illuminate\Support\Facades\Http;
|
use Illuminate\Support\Facades\Http;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class AnilistAnimeExternalApiAction.
|
|
||||||
*/
|
|
||||||
class AnilistAnimeExternalApiAction extends ExternalApiAction implements BackfillImages, BackfillResources, BackfillSynonyms
|
class AnilistAnimeExternalApiAction extends ExternalApiAction implements BackfillImages, BackfillResources, BackfillSynonyms
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Get the site to backfill.
|
* Get the site to backfill.
|
||||||
*
|
|
||||||
* @return ResourceSite
|
|
||||||
*/
|
*/
|
||||||
public function getSite(): ResourceSite
|
public function getSite(): ResourceSite
|
||||||
{
|
{
|
||||||
@@ -36,7 +31,6 @@ class AnilistAnimeExternalApiAction extends ExternalApiAction implements Backfil
|
|||||||
* Set the response after the request.
|
* Set the response after the request.
|
||||||
*
|
*
|
||||||
* @param BelongsToMany<ExternalResource, Anime> $resources
|
* @param BelongsToMany<ExternalResource, Anime> $resources
|
||||||
* @return static
|
|
||||||
*/
|
*/
|
||||||
public function handle(BelongsToMany $resources): static
|
public function handle(BelongsToMany $resources): static
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -13,15 +13,10 @@ use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
|||||||
use Illuminate\Support\Arr;
|
use Illuminate\Support\Arr;
|
||||||
use Illuminate\Support\Facades\Http;
|
use Illuminate\Support\Facades\Http;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class JikanAnimeExternalApiAction.
|
|
||||||
*/
|
|
||||||
class JikanAnimeExternalApiAction extends ExternalApiAction implements BackfillResources
|
class JikanAnimeExternalApiAction extends ExternalApiAction implements BackfillResources
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Get the site to backfill.
|
* Get the site to backfill.
|
||||||
*
|
|
||||||
* @return ResourceSite
|
|
||||||
*/
|
*/
|
||||||
public function getSite(): ResourceSite
|
public function getSite(): ResourceSite
|
||||||
{
|
{
|
||||||
@@ -32,7 +27,6 @@ class JikanAnimeExternalApiAction extends ExternalApiAction implements BackfillR
|
|||||||
* Set the response after the request.
|
* Set the response after the request.
|
||||||
*
|
*
|
||||||
* @param BelongsToMany<ExternalResource, Anime> $resources
|
* @param BelongsToMany<ExternalResource, Anime> $resources
|
||||||
* @return static
|
|
||||||
*/
|
*/
|
||||||
public function handle(BelongsToMany $resources): static
|
public function handle(BelongsToMany $resources): static
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,15 +12,10 @@ use App\Models\Wiki\ExternalResource;
|
|||||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||||
use Illuminate\Support\Facades\Http;
|
use Illuminate\Support\Facades\Http;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class LivechartAnimeExternalApiAction.
|
|
||||||
*/
|
|
||||||
class LivechartAnimeExternalApiAction extends ExternalApiAction implements BackfillResources
|
class LivechartAnimeExternalApiAction extends ExternalApiAction implements BackfillResources
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Get the site to backfill.
|
* Get the site to backfill.
|
||||||
*
|
|
||||||
* @return ResourceSite
|
|
||||||
*/
|
*/
|
||||||
public function getSite(): ResourceSite
|
public function getSite(): ResourceSite
|
||||||
{
|
{
|
||||||
@@ -31,7 +26,6 @@ class LivechartAnimeExternalApiAction extends ExternalApiAction implements Backf
|
|||||||
* Set the response after the request.
|
* Set the response after the request.
|
||||||
*
|
*
|
||||||
* @param BelongsToMany<ExternalResource, Anime> $resources
|
* @param BelongsToMany<ExternalResource, Anime> $resources
|
||||||
* @return static
|
|
||||||
*/
|
*/
|
||||||
public function handle(BelongsToMany $resources): static
|
public function handle(BelongsToMany $resources): static
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -14,15 +14,10 @@ use Illuminate\Support\Arr;
|
|||||||
use Illuminate\Support\Facades\Config;
|
use Illuminate\Support\Facades\Config;
|
||||||
use Illuminate\Support\Facades\Http;
|
use Illuminate\Support\Facades\Http;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class MalAnimeExternalApiAction.
|
|
||||||
*/
|
|
||||||
class MalAnimeExternalApiAction extends ExternalApiAction implements BackfillStudios
|
class MalAnimeExternalApiAction extends ExternalApiAction implements BackfillStudios
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Get the site to backfill.
|
* Get the site to backfill.
|
||||||
*
|
|
||||||
* @return ResourceSite
|
|
||||||
*/
|
*/
|
||||||
public function getSite(): ResourceSite
|
public function getSite(): ResourceSite
|
||||||
{
|
{
|
||||||
@@ -33,7 +28,6 @@ class MalAnimeExternalApiAction extends ExternalApiAction implements BackfillStu
|
|||||||
* Set the response after the request.
|
* Set the response after the request.
|
||||||
*
|
*
|
||||||
* @param BelongsToMany<ExternalResource, Anime> $resources
|
* @param BelongsToMany<ExternalResource, Anime> $resources
|
||||||
* @return static
|
|
||||||
*/
|
*/
|
||||||
public function handle(BelongsToMany $resources): static
|
public function handle(BelongsToMany $resources): static
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,9 +10,6 @@ use App\Enums\Models\Wiki\ImageFacet;
|
|||||||
use App\Models\BaseModel;
|
use App\Models\BaseModel;
|
||||||
use Illuminate\Support\Arr;
|
use Illuminate\Support\Arr;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class AttachImageAction.
|
|
||||||
*/
|
|
||||||
class AttachImageAction
|
class AttachImageAction
|
||||||
{
|
{
|
||||||
use CanCreateImage;
|
use CanCreateImage;
|
||||||
@@ -20,10 +17,8 @@ class AttachImageAction
|
|||||||
/**
|
/**
|
||||||
* Perform the action on the given models.
|
* Perform the action on the given models.
|
||||||
*
|
*
|
||||||
* @param BaseModel&HasImages $model
|
|
||||||
* @param array $fields
|
* @param array $fields
|
||||||
* @param ImageFacet[] $facets
|
* @param ImageFacet[] $facets
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function handle(BaseModel&HasImages $model, array $fields, array $facets): void
|
public function handle(BaseModel&HasImages $model, array $fields, array $facets): void
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,9 +10,6 @@ use App\Enums\Models\Wiki\ResourceSite;
|
|||||||
use App\Models\BaseModel;
|
use App\Models\BaseModel;
|
||||||
use Illuminate\Support\Arr;
|
use Illuminate\Support\Arr;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class AttachResourceAction.
|
|
||||||
*/
|
|
||||||
class AttachResourceAction
|
class AttachResourceAction
|
||||||
{
|
{
|
||||||
use CanCreateExternalResource;
|
use CanCreateExternalResource;
|
||||||
@@ -20,10 +17,8 @@ class AttachResourceAction
|
|||||||
/**
|
/**
|
||||||
* Handle the action.
|
* Handle the action.
|
||||||
*
|
*
|
||||||
* @param BaseModel&HasResources $model
|
|
||||||
* @param array $fields
|
* @param array $fields
|
||||||
* @param ResourceSite[] $sites
|
* @param ResourceSite[] $sites
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function handle(BaseModel&HasResources $model, array $fields, array $sites): void
|
public function handle(BaseModel&HasResources $model, array $fields, array $sites): void
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -24,9 +24,6 @@ use Illuminate\Support\Arr;
|
|||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class BackfillAnimeAction.
|
|
||||||
*/
|
|
||||||
class BackfillAnimeAction extends BackfillWikiAction
|
class BackfillAnimeAction extends BackfillWikiAction
|
||||||
{
|
{
|
||||||
use CanCreateAnimeSynonym;
|
use CanCreateAnimeSynonym;
|
||||||
@@ -36,9 +33,6 @@ class BackfillAnimeAction extends BackfillWikiAction
|
|||||||
final public const SYNONYMS = 'synonyms';
|
final public const SYNONYMS = 'synonyms';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new action instance.
|
|
||||||
*
|
|
||||||
* @param Anime $anime
|
|
||||||
* @param array $toBackfill
|
* @param array $toBackfill
|
||||||
*/
|
*/
|
||||||
public function __construct(protected Anime $anime, protected array $toBackfill)
|
public function __construct(protected Anime $anime, protected array $toBackfill)
|
||||||
@@ -48,8 +42,6 @@ class BackfillAnimeAction extends BackfillWikiAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle the action.
|
* Handle the action.
|
||||||
*
|
|
||||||
* @return ActionResult
|
|
||||||
*/
|
*/
|
||||||
public function handle(): ActionResult
|
public function handle(): ActionResult
|
||||||
{
|
{
|
||||||
@@ -71,19 +63,19 @@ class BackfillAnimeAction extends BackfillWikiAction
|
|||||||
|
|
||||||
$response = $api->handle($this->getModel()->resources());
|
$response = $api->handle($this->getModel()->resources());
|
||||||
|
|
||||||
if ($api instanceof BackfillResources) {
|
if ($response instanceof BackfillResources) {
|
||||||
$this->forResources($response);
|
$this->forResources($response);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($api instanceof BackfillImages) {
|
if ($response instanceof BackfillImages) {
|
||||||
$this->forImages($response);
|
$this->forImages($response);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($api instanceof BackfillStudios) {
|
if ($response instanceof BackfillStudios) {
|
||||||
$this->forStudios($response);
|
$this->forStudios($response);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($api instanceof BackfillSynonyms) {
|
if ($response instanceof BackfillSynonyms) {
|
||||||
$this->forSynonyms($response);
|
$this->forSynonyms($response);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -103,7 +95,7 @@ class BackfillAnimeAction extends BackfillWikiAction
|
|||||||
/**
|
/**
|
||||||
* Get the external API actions available for the backfill action.
|
* Get the external API actions available for the backfill action.
|
||||||
*
|
*
|
||||||
* @return array
|
* @return ExternalApiAction[]
|
||||||
*/
|
*/
|
||||||
protected function getExternalApiActions(): array
|
protected function getExternalApiActions(): array
|
||||||
{
|
{
|
||||||
@@ -117,9 +109,6 @@ class BackfillAnimeAction extends BackfillWikiAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the studios given the response.
|
* Create the studios given the response.
|
||||||
*
|
|
||||||
* @param ExternalApiAction&BackfillStudios $response
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
protected function forStudios(ExternalApiAction&BackfillStudios $response): void
|
protected function forStudios(ExternalApiAction&BackfillStudios $response): void
|
||||||
{
|
{
|
||||||
@@ -153,9 +142,6 @@ class BackfillAnimeAction extends BackfillWikiAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the synonyms given the response.
|
* Create the synonyms given the response.
|
||||||
*
|
|
||||||
* @param ExternalApiAction&BackfillSynonyms $api
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
protected function forSynonyms(ExternalApiAction&BackfillSynonyms $api): void
|
protected function forSynonyms(ExternalApiAction&BackfillSynonyms $api): void
|
||||||
{
|
{
|
||||||
@@ -181,8 +167,6 @@ class BackfillAnimeAction extends BackfillWikiAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the model for the action.
|
* Get the model for the action.
|
||||||
*
|
|
||||||
* @return Anime
|
|
||||||
*/
|
*/
|
||||||
protected function getModel(): Anime
|
protected function getModel(): Anime
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -26,12 +26,6 @@ class BackfillSongAction extends BackfillAction
|
|||||||
{
|
{
|
||||||
use CanCreateExternalResource;
|
use CanCreateExternalResource;
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new action instance.
|
|
||||||
*
|
|
||||||
* @param Song $song
|
|
||||||
* @param string $lnkto
|
|
||||||
*/
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
Song $song,
|
Song $song,
|
||||||
protected readonly string $lnkto,
|
protected readonly string $lnkto,
|
||||||
@@ -42,8 +36,6 @@ class BackfillSongAction extends BackfillAction
|
|||||||
/**
|
/**
|
||||||
* Handle action.
|
* Handle action.
|
||||||
*
|
*
|
||||||
* @return ActionResult
|
|
||||||
*
|
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function handle(): ActionResult
|
public function handle(): ActionResult
|
||||||
@@ -85,9 +77,6 @@ class BackfillSongAction extends BackfillAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the resource site according the external label.
|
* Get the resource site according the external label.
|
||||||
*
|
|
||||||
* @param string $label
|
|
||||||
* @return ResourceSite|null
|
|
||||||
*/
|
*/
|
||||||
protected function getMappingFromExternalSite(string $label): ?ResourceSite
|
protected function getMappingFromExternalSite(string $label): ?ResourceSite
|
||||||
{
|
{
|
||||||
@@ -102,8 +91,6 @@ class BackfillSongAction extends BackfillAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the model the action is handling.
|
* Get the model the action is handling.
|
||||||
*
|
|
||||||
* @return Song
|
|
||||||
*/
|
*/
|
||||||
protected function getModel(): Song
|
protected function getModel(): Song
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -14,15 +14,9 @@ use Exception;
|
|||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class BackfillStudioAction.
|
|
||||||
*/
|
|
||||||
class BackfillStudioAction extends BackfillWikiAction
|
class BackfillStudioAction extends BackfillWikiAction
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Create a new action instance.
|
|
||||||
*
|
|
||||||
* @param Studio $studio
|
|
||||||
* @param array $toBackfill
|
* @param array $toBackfill
|
||||||
*/
|
*/
|
||||||
public function __construct(protected Studio $studio, protected array $toBackfill)
|
public function __construct(protected Studio $studio, protected array $toBackfill)
|
||||||
@@ -32,8 +26,6 @@ class BackfillStudioAction extends BackfillWikiAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle the action.
|
* Handle the action.
|
||||||
*
|
|
||||||
* @return ActionResult
|
|
||||||
*/
|
*/
|
||||||
public function handle(): ActionResult
|
public function handle(): ActionResult
|
||||||
{
|
{
|
||||||
@@ -71,7 +63,7 @@ class BackfillStudioAction extends BackfillWikiAction
|
|||||||
/**
|
/**
|
||||||
* Get the external API actions available for the backfill action.
|
* Get the external API actions available for the backfill action.
|
||||||
*
|
*
|
||||||
* @return array
|
* @return ExternalApiAction[]
|
||||||
*/
|
*/
|
||||||
protected function getExternalApiActions(): array
|
protected function getExternalApiActions(): array
|
||||||
{
|
{
|
||||||
@@ -82,8 +74,6 @@ class BackfillStudioAction extends BackfillWikiAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the model for the action.
|
* Get the model for the action.
|
||||||
*
|
|
||||||
* @return Studio
|
|
||||||
*/
|
*/
|
||||||
protected function getModel(): Studio
|
protected function getModel(): Studio
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -11,9 +11,6 @@ use App\Enums\Models\Wiki\ResourceSite;
|
|||||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||||
use Illuminate\Support\Arr;
|
use Illuminate\Support\Arr;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class ExternalApiAction.
|
|
||||||
*/
|
|
||||||
abstract class ExternalApiAction
|
abstract class ExternalApiAction
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@@ -25,8 +22,6 @@ abstract class ExternalApiAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the site to backfill.
|
* Get the site to backfill.
|
||||||
*
|
|
||||||
* @return ResourceSite
|
|
||||||
*/
|
*/
|
||||||
abstract public function getSite(): ResourceSite;
|
abstract public function getSite(): ResourceSite;
|
||||||
|
|
||||||
@@ -34,7 +29,6 @@ abstract class ExternalApiAction
|
|||||||
* Set the response after the request.
|
* Set the response after the request.
|
||||||
*
|
*
|
||||||
* @param BelongsToMany $resources
|
* @param BelongsToMany $resources
|
||||||
* @return static
|
|
||||||
*/
|
*/
|
||||||
abstract public function handle(BelongsToMany $resources): static;
|
abstract public function handle(BelongsToMany $resources): static;
|
||||||
|
|
||||||
|
|||||||
@@ -14,9 +14,6 @@ use Illuminate\Support\Arr;
|
|||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class ManageSongPerformances.
|
|
||||||
*/
|
|
||||||
class ManageSongPerformances
|
class ManageSongPerformances
|
||||||
{
|
{
|
||||||
protected int $song;
|
protected int $song;
|
||||||
@@ -25,9 +22,6 @@ class ManageSongPerformances
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the song of the performances.
|
* Add the song of the performances.
|
||||||
*
|
|
||||||
* @param Song|int $song
|
|
||||||
* @return static
|
|
||||||
*/
|
*/
|
||||||
public function forSong(Song|int $song): static
|
public function forSong(Song|int $song): static
|
||||||
{
|
{
|
||||||
@@ -38,11 +32,6 @@ class ManageSongPerformances
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a single artist to the song performance.
|
* Add a single artist to the song performance.
|
||||||
*
|
|
||||||
* @param int $artist
|
|
||||||
* @param string|null $alias
|
|
||||||
* @param string|null $as
|
|
||||||
* @return static
|
|
||||||
*/
|
*/
|
||||||
public function addSingleArtist(int $artist, ?string $alias = null, ?string $as = null): static
|
public function addSingleArtist(int $artist, ?string $alias = null, ?string $as = null): static
|
||||||
{
|
{
|
||||||
@@ -58,11 +47,6 @@ class ManageSongPerformances
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a group data to the performance.
|
* Add a group data to the performance.
|
||||||
*
|
|
||||||
* @param int $group
|
|
||||||
* @param string|null $alias
|
|
||||||
* @param string|null $as
|
|
||||||
* @return static
|
|
||||||
*/
|
*/
|
||||||
public function addGroupData(int $group, ?string $alias = null, ?string $as = null): static
|
public function addGroupData(int $group, ?string $alias = null, ?string $as = null): static
|
||||||
{
|
{
|
||||||
@@ -76,12 +60,6 @@ class ManageSongPerformances
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a membership to the song.
|
* Add a membership to the song.
|
||||||
*
|
|
||||||
* @param int $group
|
|
||||||
* @param int $member
|
|
||||||
* @param string|null $alias
|
|
||||||
* @param string|null $as
|
|
||||||
* @return static
|
|
||||||
*/
|
*/
|
||||||
public function addMembership(int $group, int $member, ?string $alias = null, ?string $as = null): static
|
public function addMembership(int $group, int $member, ?string $alias = null, ?string $as = null): static
|
||||||
{
|
{
|
||||||
@@ -102,8 +80,6 @@ class ManageSongPerformances
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Commit the performances to the song.
|
* Commit the performances to the song.
|
||||||
*
|
|
||||||
* @return static
|
|
||||||
*/
|
*/
|
||||||
public function commit(): static
|
public function commit(): static
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,15 +12,10 @@ use App\Models\Wiki\ExternalResource;
|
|||||||
use App\Models\Wiki\Studio;
|
use App\Models\Wiki\Studio;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class MalStudioExternalApiAction.
|
|
||||||
*/
|
|
||||||
class MalStudioExternalApiAction extends ExternalApiAction implements BackfillImages
|
class MalStudioExternalApiAction extends ExternalApiAction implements BackfillImages
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Get the site to backfill.
|
* Get the site to backfill.
|
||||||
*
|
|
||||||
* @return ResourceSite
|
|
||||||
*/
|
*/
|
||||||
public function getSite(): ResourceSite
|
public function getSite(): ResourceSite
|
||||||
{
|
{
|
||||||
@@ -31,7 +26,6 @@ class MalStudioExternalApiAction extends ExternalApiAction implements BackfillIm
|
|||||||
* Set the response after the request.
|
* Set the response after the request.
|
||||||
*
|
*
|
||||||
* @param BelongsToMany<ExternalResource, Studio> $resources
|
* @param BelongsToMany<ExternalResource, Studio> $resources
|
||||||
* @return static
|
|
||||||
*/
|
*/
|
||||||
public function handle(BelongsToMany $resources): static
|
public function handle(BelongsToMany $resources): static
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -39,13 +39,6 @@ use Illuminate\Support\Str;
|
|||||||
*/
|
*/
|
||||||
class BackfillAudioAction extends BackfillAction
|
class BackfillAudioAction extends BackfillAction
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Create a new action instance.
|
|
||||||
*
|
|
||||||
* @param Video $video
|
|
||||||
* @param DeriveSourceVideo $deriveSourceVideo
|
|
||||||
* @param OverwriteAudio $overwriteAudio
|
|
||||||
*/
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
Video $video,
|
Video $video,
|
||||||
protected readonly DeriveSourceVideo $deriveSourceVideo = DeriveSourceVideo::YES,
|
protected readonly DeriveSourceVideo $deriveSourceVideo = DeriveSourceVideo::YES,
|
||||||
@@ -58,8 +51,6 @@ class BackfillAudioAction extends BackfillAction
|
|||||||
/**
|
/**
|
||||||
* Handle action.
|
* Handle action.
|
||||||
*
|
*
|
||||||
* @return ActionResult
|
|
||||||
*
|
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function handle(): ActionResult
|
public function handle(): ActionResult
|
||||||
@@ -103,8 +94,6 @@ class BackfillAudioAction extends BackfillAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the model the action is handling.
|
* Get the model the action is handling.
|
||||||
*
|
|
||||||
* @return Video
|
|
||||||
*/
|
*/
|
||||||
protected function getModel(): Video
|
protected function getModel(): Video
|
||||||
{
|
{
|
||||||
@@ -113,8 +102,6 @@ class BackfillAudioAction extends BackfillAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the relation to audio.
|
* Get the relation to audio.
|
||||||
*
|
|
||||||
* @return BelongsTo
|
|
||||||
*/
|
*/
|
||||||
protected function relation(): BelongsTo
|
protected function relation(): BelongsTo
|
||||||
{
|
{
|
||||||
@@ -123,8 +110,6 @@ class BackfillAudioAction extends BackfillAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if the source video should be derived.
|
* Determine if the source video should be derived.
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
*/
|
||||||
protected function deriveSourceVideo(): bool
|
protected function deriveSourceVideo(): bool
|
||||||
{
|
{
|
||||||
@@ -133,8 +118,6 @@ class BackfillAudioAction extends BackfillAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if audio should be overwritten.
|
* Determine if audio should be overwritten.
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
*/
|
||||||
protected function overwriteAudio(): bool
|
protected function overwriteAudio(): bool
|
||||||
{
|
{
|
||||||
@@ -143,8 +126,6 @@ class BackfillAudioAction extends BackfillAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if the new audio should replace a related one.
|
* Determine if the new audio should replace a related one.
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
*/
|
||||||
protected function replaceRelatedAudio(): bool
|
protected function replaceRelatedAudio(): bool
|
||||||
{
|
{
|
||||||
@@ -154,8 +135,6 @@ class BackfillAudioAction extends BackfillAction
|
|||||||
/**
|
/**
|
||||||
* Get or Create Audio.
|
* Get or Create Audio.
|
||||||
*
|
*
|
||||||
* @return Audio|null
|
|
||||||
*
|
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
protected function getAudio(): ?Audio
|
protected function getAudio(): ?Audio
|
||||||
@@ -213,9 +192,6 @@ class BackfillAudioAction extends BackfillAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the source video for the given video.
|
* Get the source video for the given video.
|
||||||
*
|
|
||||||
* @param string $operation
|
|
||||||
* @return Video|null
|
|
||||||
*/
|
*/
|
||||||
protected function getSourceVideo(string $operation = '>'): ?Video
|
protected function getSourceVideo(string $operation = '>'): ?Video
|
||||||
{
|
{
|
||||||
@@ -269,9 +245,6 @@ class BackfillAudioAction extends BackfillAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Extract audio stream from video and store in filesystem.
|
* Extract audio stream from video and store in filesystem.
|
||||||
*
|
|
||||||
* @param Video $video
|
|
||||||
* @return Audio|null
|
|
||||||
*/
|
*/
|
||||||
protected function extractAudio(Video $video): ?Audio
|
protected function extractAudio(Video $video): ?Audio
|
||||||
{
|
{
|
||||||
@@ -319,9 +292,6 @@ class BackfillAudioAction extends BackfillAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Attach Audio to model.
|
* Attach Audio to model.
|
||||||
*
|
|
||||||
* @param Audio $audio
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
protected function attachAudio(Audio $audio): void
|
protected function attachAudio(Audio $audio): void
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -33,8 +33,6 @@ class ReconcileDumpRepositoriesAction extends ReconcileRepositoriesAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Callback for create and delete set operation item comparison.
|
* Callback for create and delete set operation item comparison.
|
||||||
*
|
|
||||||
* @return Closure
|
|
||||||
*/
|
*/
|
||||||
protected function diffCallbackForCreateDelete(): Closure
|
protected function diffCallbackForCreateDelete(): Closure
|
||||||
{
|
{
|
||||||
@@ -53,8 +51,6 @@ class ReconcileDumpRepositoriesAction extends ReconcileRepositoriesAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Callback for update set operation item comparison.
|
* Callback for update set operation item comparison.
|
||||||
*
|
|
||||||
* @return Closure
|
|
||||||
*/
|
*/
|
||||||
protected function diffCallbackForUpdate(): Closure
|
protected function diffCallbackForUpdate(): Closure
|
||||||
{
|
{
|
||||||
@@ -65,8 +61,6 @@ class ReconcileDumpRepositoriesAction extends ReconcileRepositoriesAction
|
|||||||
* Get source model that has been updated for destination model.
|
* Get source model that has been updated for destination model.
|
||||||
*
|
*
|
||||||
* @param Collection $sourceModels
|
* @param Collection $sourceModels
|
||||||
* @param Model $destinationModel
|
|
||||||
* @return Model|null
|
|
||||||
*/
|
*/
|
||||||
protected function resolveUpdatedModel(Collection $sourceModels, Model $destinationModel): ?Model
|
protected function resolveUpdatedModel(Collection $sourceModels, Model $destinationModel): ?Model
|
||||||
{
|
{
|
||||||
@@ -79,7 +73,6 @@ class ReconcileDumpRepositoriesAction extends ReconcileRepositoriesAction
|
|||||||
* @param Collection $created
|
* @param Collection $created
|
||||||
* @param Collection $deleted
|
* @param Collection $deleted
|
||||||
* @param Collection $updated
|
* @param Collection $updated
|
||||||
* @return ReconcileResults
|
|
||||||
*/
|
*/
|
||||||
protected function getResults(Collection $created, Collection $deleted, Collection $updated): ReconcileResults
|
protected function getResults(Collection $created, Collection $deleted, Collection $updated): ReconcileResults
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ abstract class ReconcileRepositoriesAction
|
|||||||
*
|
*
|
||||||
* @param RepositoryInterface<TModel> $source
|
* @param RepositoryInterface<TModel> $source
|
||||||
* @param RepositoryInterface<TModel> $destination
|
* @param RepositoryInterface<TModel> $destination
|
||||||
* @return ReconcileResults
|
|
||||||
*
|
*
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
@@ -66,8 +65,6 @@ abstract class ReconcileRepositoriesAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Callback for create and delete set operation item comparison.
|
* Callback for create and delete set operation item comparison.
|
||||||
*
|
|
||||||
* @return Closure
|
|
||||||
*/
|
*/
|
||||||
abstract protected function diffCallbackForCreateDelete(): Closure;
|
abstract protected function diffCallbackForCreateDelete(): Closure;
|
||||||
|
|
||||||
@@ -116,8 +113,6 @@ abstract class ReconcileRepositoriesAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Callback for update set operation item comparison.
|
* Callback for update set operation item comparison.
|
||||||
*
|
|
||||||
* @return Closure
|
|
||||||
*/
|
*/
|
||||||
abstract protected function diffCallbackForUpdate(): Closure;
|
abstract protected function diffCallbackForUpdate(): Closure;
|
||||||
|
|
||||||
@@ -125,8 +120,6 @@ abstract class ReconcileRepositoriesAction
|
|||||||
* Get source model that has been updated for destination model.
|
* Get source model that has been updated for destination model.
|
||||||
*
|
*
|
||||||
* @param Collection $sourceModels
|
* @param Collection $sourceModels
|
||||||
* @param Model $destinationModel
|
|
||||||
* @return Model|null
|
|
||||||
*/
|
*/
|
||||||
abstract protected function resolveUpdatedModel(Collection $sourceModels, Model $destinationModel): ?Model;
|
abstract protected function resolveUpdatedModel(Collection $sourceModels, Model $destinationModel): ?Model;
|
||||||
|
|
||||||
@@ -159,7 +152,6 @@ abstract class ReconcileRepositoriesAction
|
|||||||
* @param Collection $created
|
* @param Collection $created
|
||||||
* @param Collection $deleted
|
* @param Collection $deleted
|
||||||
* @param Collection $updated
|
* @param Collection $updated
|
||||||
* @return ReconcileResults
|
|
||||||
*/
|
*/
|
||||||
abstract protected function getResults(Collection $created, Collection $deleted, Collection $updated): ReconcileResults;
|
abstract protected function getResults(Collection $created, Collection $deleted, Collection $updated): ReconcileResults;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,8 +21,6 @@ use Illuminate\Support\Str;
|
|||||||
abstract class ReconcileResults extends ActionResult
|
abstract class ReconcileResults extends ActionResult
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Create a new results instance.
|
|
||||||
*
|
|
||||||
* @param Collection $created
|
* @param Collection $created
|
||||||
* @param Collection $deleted
|
* @param Collection $deleted
|
||||||
* @param Collection $updated
|
* @param Collection $updated
|
||||||
@@ -67,8 +65,6 @@ abstract class ReconcileResults extends ActionResult
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines if any successful changes were made during reconciliation.
|
* Determines if any successful changes were made during reconciliation.
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
*/
|
||||||
public function hasChanges(): bool
|
public function hasChanges(): bool
|
||||||
{
|
{
|
||||||
@@ -78,8 +74,6 @@ abstract class ReconcileResults extends ActionResult
|
|||||||
/**
|
/**
|
||||||
* Write reconcile results to log.
|
* Write reconcile results to log.
|
||||||
*
|
*
|
||||||
* @return void
|
|
||||||
*
|
|
||||||
* @noinspection PhpMissingParentCallCommonInspection
|
* @noinspection PhpMissingParentCallCommonInspection
|
||||||
*/
|
*/
|
||||||
public function toLog(): void
|
public function toLog(): void
|
||||||
@@ -94,9 +88,6 @@ abstract class ReconcileResults extends ActionResult
|
|||||||
/**
|
/**
|
||||||
* Write reconcile results to console output.
|
* Write reconcile results to console output.
|
||||||
*
|
*
|
||||||
* @param Command $command
|
|
||||||
* @return void
|
|
||||||
*
|
|
||||||
* @noinspection PhpMissingParentCallCommonInspection
|
* @noinspection PhpMissingParentCallCommonInspection
|
||||||
*/
|
*/
|
||||||
public function toConsole(Command $command): void
|
public function toConsole(Command $command): void
|
||||||
@@ -111,8 +102,6 @@ abstract class ReconcileResults extends ActionResult
|
|||||||
/**
|
/**
|
||||||
* Get the action result message.
|
* Get the action result message.
|
||||||
*
|
*
|
||||||
* @return string|null
|
|
||||||
*
|
|
||||||
* @noinspection PhpMissingParentCallCommonInspection
|
* @noinspection PhpMissingParentCallCommonInspection
|
||||||
*/
|
*/
|
||||||
public function getMessage(): ?string
|
public function getMessage(): ?string
|
||||||
@@ -135,7 +124,6 @@ abstract class ReconcileResults extends ActionResult
|
|||||||
* Get the user-friendly label for the model class name.
|
* Get the user-friendly label for the model class name.
|
||||||
*
|
*
|
||||||
* @param int|array|Countable $models
|
* @param int|array|Countable $models
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
protected function label(int|array|Countable $models = 1): string
|
protected function label(int|array|Countable $models = 1): string
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -33,8 +33,6 @@ class ReconcileAudioRepositoriesAction extends ReconcileRepositoriesAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Callback for create and delete set operation item comparison.
|
* Callback for create and delete set operation item comparison.
|
||||||
*
|
|
||||||
* @return Closure
|
|
||||||
*/
|
*/
|
||||||
protected function diffCallbackForCreateDelete(): Closure
|
protected function diffCallbackForCreateDelete(): Closure
|
||||||
{
|
{
|
||||||
@@ -60,8 +58,6 @@ class ReconcileAudioRepositoriesAction extends ReconcileRepositoriesAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Callback for update set operation item comparison.
|
* Callback for update set operation item comparison.
|
||||||
*
|
|
||||||
* @return Closure
|
|
||||||
*/
|
*/
|
||||||
protected function diffCallbackForUpdate(): Closure
|
protected function diffCallbackForUpdate(): Closure
|
||||||
{
|
{
|
||||||
@@ -72,8 +68,6 @@ class ReconcileAudioRepositoriesAction extends ReconcileRepositoriesAction
|
|||||||
* Get source model that has been updated for destination model.
|
* Get source model that has been updated for destination model.
|
||||||
*
|
*
|
||||||
* @param Collection $sourceModels
|
* @param Collection $sourceModels
|
||||||
* @param Model $destinationModel
|
|
||||||
* @return Model|null
|
|
||||||
*/
|
*/
|
||||||
protected function resolveUpdatedModel(Collection $sourceModels, Model $destinationModel): ?Model
|
protected function resolveUpdatedModel(Collection $sourceModels, Model $destinationModel): ?Model
|
||||||
{
|
{
|
||||||
@@ -89,7 +83,6 @@ class ReconcileAudioRepositoriesAction extends ReconcileRepositoriesAction
|
|||||||
* @param Collection $created
|
* @param Collection $created
|
||||||
* @param Collection $deleted
|
* @param Collection $deleted
|
||||||
* @param Collection $updated
|
* @param Collection $updated
|
||||||
* @return ReconcileResults
|
|
||||||
*/
|
*/
|
||||||
protected function getResults(Collection $created, Collection $deleted, Collection $updated): ReconcileResults
|
protected function getResults(Collection $created, Collection $deleted, Collection $updated): ReconcileResults
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -33,8 +33,6 @@ class ReconcileVideoRepositoriesAction extends ReconcileRepositoriesAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Callback for create and delete set operation item comparison.
|
* Callback for create and delete set operation item comparison.
|
||||||
*
|
|
||||||
* @return Closure
|
|
||||||
*/
|
*/
|
||||||
protected function diffCallbackForCreateDelete(): Closure
|
protected function diffCallbackForCreateDelete(): Closure
|
||||||
{
|
{
|
||||||
@@ -60,8 +58,6 @@ class ReconcileVideoRepositoriesAction extends ReconcileRepositoriesAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Callback for update set operation item comparison.
|
* Callback for update set operation item comparison.
|
||||||
*
|
|
||||||
* @return Closure
|
|
||||||
*/
|
*/
|
||||||
protected function diffCallbackForUpdate(): Closure
|
protected function diffCallbackForUpdate(): Closure
|
||||||
{
|
{
|
||||||
@@ -72,8 +68,6 @@ class ReconcileVideoRepositoriesAction extends ReconcileRepositoriesAction
|
|||||||
* Get source model that has been updated for destination model.
|
* Get source model that has been updated for destination model.
|
||||||
*
|
*
|
||||||
* @param Collection $sourceModels
|
* @param Collection $sourceModels
|
||||||
* @param Model $destinationModel
|
|
||||||
* @return Model|null
|
|
||||||
*/
|
*/
|
||||||
protected function resolveUpdatedModel(Collection $sourceModels, Model $destinationModel): ?Model
|
protected function resolveUpdatedModel(Collection $sourceModels, Model $destinationModel): ?Model
|
||||||
{
|
{
|
||||||
@@ -89,7 +83,6 @@ class ReconcileVideoRepositoriesAction extends ReconcileRepositoriesAction
|
|||||||
* @param Collection $created
|
* @param Collection $created
|
||||||
* @param Collection $deleted
|
* @param Collection $deleted
|
||||||
* @param Collection $updated
|
* @param Collection $updated
|
||||||
* @return ReconcileResults
|
|
||||||
*/
|
*/
|
||||||
protected function getResults(Collection $created, Collection $deleted, Collection $updated): ReconcileResults
|
protected function getResults(Collection $created, Collection $deleted, Collection $updated): ReconcileResults
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -33,8 +33,6 @@ class ReconcileScriptRepositoriesAction extends ReconcileRepositoriesAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Callback for create and delete set operation item comparison.
|
* Callback for create and delete set operation item comparison.
|
||||||
*
|
|
||||||
* @return Closure
|
|
||||||
*/
|
*/
|
||||||
protected function diffCallbackForCreateDelete(): Closure
|
protected function diffCallbackForCreateDelete(): Closure
|
||||||
{
|
{
|
||||||
@@ -53,8 +51,6 @@ class ReconcileScriptRepositoriesAction extends ReconcileRepositoriesAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Callback for update set operation item comparison.
|
* Callback for update set operation item comparison.
|
||||||
*
|
|
||||||
* @return Closure
|
|
||||||
*/
|
*/
|
||||||
protected function diffCallbackForUpdate(): Closure
|
protected function diffCallbackForUpdate(): Closure
|
||||||
{
|
{
|
||||||
@@ -65,8 +61,6 @@ class ReconcileScriptRepositoriesAction extends ReconcileRepositoriesAction
|
|||||||
* Get source model that has been updated for destination model.
|
* Get source model that has been updated for destination model.
|
||||||
*
|
*
|
||||||
* @param Collection $sourceModels
|
* @param Collection $sourceModels
|
||||||
* @param Model $destinationModel
|
|
||||||
* @return Model|null
|
|
||||||
*/
|
*/
|
||||||
protected function resolveUpdatedModel(Collection $sourceModels, Model $destinationModel): ?Model
|
protected function resolveUpdatedModel(Collection $sourceModels, Model $destinationModel): ?Model
|
||||||
{
|
{
|
||||||
@@ -79,7 +73,6 @@ class ReconcileScriptRepositoriesAction extends ReconcileRepositoriesAction
|
|||||||
* @param Collection $created
|
* @param Collection $created
|
||||||
* @param Collection $deleted
|
* @param Collection $deleted
|
||||||
* @param Collection $updated
|
* @param Collection $updated
|
||||||
* @return ReconcileResults
|
|
||||||
*/
|
*/
|
||||||
protected function getResults(Collection $created, Collection $deleted, Collection $updated): ReconcileResults
|
protected function getResults(Collection $created, Collection $deleted, Collection $updated): ReconcileResults
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -27,14 +27,9 @@ use Spatie\DbDumper\Databases\Sqlite;
|
|||||||
use Spatie\DbDumper\DbDumper;
|
use Spatie\DbDumper\DbDumper;
|
||||||
use Spatie\DbDumper\Exceptions\CannotSetParameter;
|
use Spatie\DbDumper\Exceptions\CannotSetParameter;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class DumpAction.
|
|
||||||
*/
|
|
||||||
abstract class DumpAction
|
abstract class DumpAction
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Create a new action instance.
|
|
||||||
*
|
|
||||||
* @param array<string, mixed> $options
|
* @param array<string, mixed> $options
|
||||||
*/
|
*/
|
||||||
public function __construct(protected readonly array $options = []) {}
|
public function __construct(protected readonly array $options = []) {}
|
||||||
@@ -42,8 +37,6 @@ abstract class DumpAction
|
|||||||
/**
|
/**
|
||||||
* Handle action.
|
* Handle action.
|
||||||
*
|
*
|
||||||
* @return ActionResult
|
|
||||||
*
|
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function handle(): ActionResult
|
public function handle(): ActionResult
|
||||||
@@ -92,9 +85,6 @@ abstract class DumpAction
|
|||||||
/**
|
/**
|
||||||
* Get the dumper for the database connection.
|
* Get the dumper for the database connection.
|
||||||
*
|
*
|
||||||
* @param Connection $connection
|
|
||||||
* @return DbDumper|null
|
|
||||||
*
|
|
||||||
* @throws CannotSetParameter
|
* @throws CannotSetParameter
|
||||||
*/
|
*/
|
||||||
protected function getDumper(Connection $connection): ?DbDumper
|
protected function getDumper(Connection $connection): ?DbDumper
|
||||||
@@ -117,9 +107,6 @@ abstract class DumpAction
|
|||||||
/**
|
/**
|
||||||
* Configure Sqlite database dumper.
|
* Configure Sqlite database dumper.
|
||||||
*
|
*
|
||||||
* @param Connection $connection
|
|
||||||
* @return Sqlite
|
|
||||||
*
|
|
||||||
* @throws RuntimeException
|
* @throws RuntimeException
|
||||||
* @throws CannotSetParameter
|
* @throws CannotSetParameter
|
||||||
*/
|
*/
|
||||||
@@ -140,9 +127,6 @@ abstract class DumpAction
|
|||||||
/**
|
/**
|
||||||
* Configure MySQL database dumper.
|
* Configure MySQL database dumper.
|
||||||
*
|
*
|
||||||
* @param Connection $connection
|
|
||||||
* @return MySql
|
|
||||||
*
|
|
||||||
* @throws CannotSetParameter
|
* @throws CannotSetParameter
|
||||||
*/
|
*/
|
||||||
protected function prepareMySqlDumper(Connection $connection): MySql
|
protected function prepareMySqlDumper(Connection $connection): MySql
|
||||||
@@ -226,9 +210,6 @@ abstract class DumpAction
|
|||||||
/**
|
/**
|
||||||
* Configure PostgreSql database dumper.
|
* Configure PostgreSql database dumper.
|
||||||
*
|
*
|
||||||
* @param Connection $connection
|
|
||||||
* @return PostgreSql
|
|
||||||
*
|
|
||||||
* @throws CannotSetParameter
|
* @throws CannotSetParameter
|
||||||
*/
|
*/
|
||||||
protected function preparePostgreSqlDumper(Connection $connection): PostgreSql
|
protected function preparePostgreSqlDumper(Connection $connection): PostgreSql
|
||||||
@@ -264,9 +245,6 @@ abstract class DumpAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if the string option is set.
|
* Determine if the string option is set.
|
||||||
*
|
|
||||||
* @param string $key
|
|
||||||
* @return bool
|
|
||||||
*/
|
*/
|
||||||
protected function hasOption(string $key): bool
|
protected function hasOption(string $key): bool
|
||||||
{
|
{
|
||||||
@@ -275,9 +253,6 @@ abstract class DumpAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the option by key.
|
* Get the option by key.
|
||||||
*
|
|
||||||
* @param string $key
|
|
||||||
* @return mixed
|
|
||||||
*/
|
*/
|
||||||
protected function option(string $key): mixed
|
protected function option(string $key): mixed
|
||||||
{
|
{
|
||||||
@@ -288,8 +263,6 @@ abstract class DumpAction
|
|||||||
* The temporary path for the database dump.
|
* The temporary path for the database dump.
|
||||||
* Note: The dumper library does not support writing to disk, so we have to write to the local filesystem first.
|
* Note: The dumper library does not support writing to disk, so we have to write to the local filesystem first.
|
||||||
* Pattern: "animethemes-db-dump-{concern}-{milliseconds from epoch}.sql".
|
* Pattern: "animethemes-db-dump-{concern}-{milliseconds from epoch}.sql".
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
abstract protected function getDumpFile(): string;
|
abstract protected function getDumpFile(): string;
|
||||||
|
|
||||||
|
|||||||
@@ -14,9 +14,6 @@ use Illuminate\Support\Facades\Date;
|
|||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class DumpAdminAction.
|
|
||||||
*/
|
|
||||||
class DumpAdminAction extends DumpAction
|
class DumpAdminAction extends DumpAction
|
||||||
{
|
{
|
||||||
use ReconcilesDumpRepositories;
|
use ReconcilesDumpRepositories;
|
||||||
@@ -44,8 +41,6 @@ class DumpAdminAction extends DumpAction
|
|||||||
* The temporary path for the database dump.
|
* The temporary path for the database dump.
|
||||||
* Note: The dumper library does not support writing to disk, so we have to write to the local filesystem first.
|
* Note: The dumper library does not support writing to disk, so we have to write to the local filesystem first.
|
||||||
* Pattern: "animethemes-db-dump-admin-{milliseconds from epoch}.sql".
|
* Pattern: "animethemes-db-dump-admin-{milliseconds from epoch}.sql".
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
protected function getDumpFile(): string
|
protected function getDumpFile(): string
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -13,9 +13,6 @@ use Illuminate\Support\Facades\Date;
|
|||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class DumpAuthAction.
|
|
||||||
*/
|
|
||||||
class DumpAuthAction extends DumpAction
|
class DumpAuthAction extends DumpAction
|
||||||
{
|
{
|
||||||
use ReconcilesDumpRepositories;
|
use ReconcilesDumpRepositories;
|
||||||
@@ -48,8 +45,6 @@ class DumpAuthAction extends DumpAction
|
|||||||
* The temporary path for the database dump.
|
* The temporary path for the database dump.
|
||||||
* Note: The dumper library does not support writing to disk, so we have to write to the local filesystem first.
|
* Note: The dumper library does not support writing to disk, so we have to write to the local filesystem first.
|
||||||
* Pattern: "animethemes-db-dump-auth-{milliseconds from epoch}.sql".
|
* Pattern: "animethemes-db-dump-auth-{milliseconds from epoch}.sql".
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
protected function getDumpFile(): string
|
protected function getDumpFile(): string
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,9 +10,6 @@ use Illuminate\Support\Facades\Date;
|
|||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class DumpDiscordAction.
|
|
||||||
*/
|
|
||||||
class DumpDiscordAction extends DumpAction
|
class DumpDiscordAction extends DumpAction
|
||||||
{
|
{
|
||||||
use ReconcilesDumpRepositories;
|
use ReconcilesDumpRepositories;
|
||||||
@@ -35,8 +32,6 @@ class DumpDiscordAction extends DumpAction
|
|||||||
* The temporary path for the database dump.
|
* The temporary path for the database dump.
|
||||||
* Note: The dumper library does not support writing to disk, so we have to write to the local filesystem first.
|
* Note: The dumper library does not support writing to disk, so we have to write to the local filesystem first.
|
||||||
* Pattern: "animethemes-db-dump-discord-{milliseconds from epoch}.sql".
|
* Pattern: "animethemes-db-dump-discord-{milliseconds from epoch}.sql".
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
protected function getDumpFile(): string
|
protected function getDumpFile(): string
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,9 +10,6 @@ use Illuminate\Support\Facades\Date;
|
|||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class DumpDocumentAction.
|
|
||||||
*/
|
|
||||||
class DumpDocumentAction extends DumpAction
|
class DumpDocumentAction extends DumpAction
|
||||||
{
|
{
|
||||||
use ReconcilesDumpRepositories;
|
use ReconcilesDumpRepositories;
|
||||||
@@ -35,8 +32,6 @@ class DumpDocumentAction extends DumpAction
|
|||||||
* The temporary path for the database dump.
|
* The temporary path for the database dump.
|
||||||
* Note: The dumper library does not support writing to disk, so we have to write to the local filesystem first.
|
* Note: The dumper library does not support writing to disk, so we have to write to the local filesystem first.
|
||||||
* Pattern: "animethemes-db-dump-document-{milliseconds from epoch}.sql".
|
* Pattern: "animethemes-db-dump-document-{milliseconds from epoch}.sql".
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
protected function getDumpFile(): string
|
protected function getDumpFile(): string
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -14,9 +14,6 @@ use Illuminate\Support\Facades\Date;
|
|||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class DumpListAction.
|
|
||||||
*/
|
|
||||||
class DumpListAction extends DumpAction
|
class DumpListAction extends DumpAction
|
||||||
{
|
{
|
||||||
use ReconcilesDumpRepositories;
|
use ReconcilesDumpRepositories;
|
||||||
@@ -43,8 +40,6 @@ class DumpListAction extends DumpAction
|
|||||||
* The temporary path for the database dump.
|
* The temporary path for the database dump.
|
||||||
* Note: The dumper library does not support writing to disk, so we have to write to the local filesystem first.
|
* Note: The dumper library does not support writing to disk, so we have to write to the local filesystem first.
|
||||||
* Pattern: "animethemes-db-dump-list-{milliseconds from epoch}.sql".
|
* Pattern: "animethemes-db-dump-list-{milliseconds from epoch}.sql".
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
protected function getDumpFile(): string
|
protected function getDumpFile(): string
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,9 +15,6 @@ use Illuminate\Support\Facades\Date;
|
|||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class DumpUserAction.
|
|
||||||
*/
|
|
||||||
class DumpUserAction extends DumpAction
|
class DumpUserAction extends DumpAction
|
||||||
{
|
{
|
||||||
use ReconcilesDumpRepositories;
|
use ReconcilesDumpRepositories;
|
||||||
@@ -45,8 +42,6 @@ class DumpUserAction extends DumpAction
|
|||||||
* The temporary path for the database dump.
|
* The temporary path for the database dump.
|
||||||
* Note: The dumper library does not support writing to disk, so we have to write to the local filesystem first.
|
* Note: The dumper library does not support writing to disk, so we have to write to the local filesystem first.
|
||||||
* Pattern: "animethemes-db-dump-user-{milliseconds from epoch}.sql".
|
* Pattern: "animethemes-db-dump-user-{milliseconds from epoch}.sql".
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
protected function getDumpFile(): string
|
protected function getDumpFile(): string
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -11,9 +11,6 @@ use Illuminate\Support\Facades\Date;
|
|||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class DumpViewAction.
|
|
||||||
*/
|
|
||||||
class DumpViewAction extends DumpAction
|
class DumpViewAction extends DumpAction
|
||||||
{
|
{
|
||||||
use ReconcilesDumpRepositories;
|
use ReconcilesDumpRepositories;
|
||||||
@@ -37,8 +34,6 @@ class DumpViewAction extends DumpAction
|
|||||||
* The temporary path for the database dump.
|
* The temporary path for the database dump.
|
||||||
* Note: The dumper library does not support writing to disk, so we have to write to the local filesystem first.
|
* Note: The dumper library does not support writing to disk, so we have to write to the local filesystem first.
|
||||||
* Pattern: "animethemes-db-dump-view-{milliseconds from epoch}.sql".
|
* Pattern: "animethemes-db-dump-view-{milliseconds from epoch}.sql".
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
protected function getDumpFile(): string
|
protected function getDumpFile(): string
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -37,9 +37,6 @@ use Illuminate\Support\Facades\Date;
|
|||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class DumpWikiAction.
|
|
||||||
*/
|
|
||||||
class DumpWikiAction extends DumpAction
|
class DumpWikiAction extends DumpAction
|
||||||
{
|
{
|
||||||
use ReconcilesDumpRepositories;
|
use ReconcilesDumpRepositories;
|
||||||
@@ -89,8 +86,6 @@ class DumpWikiAction extends DumpAction
|
|||||||
* The temporary path for the database dump.
|
* The temporary path for the database dump.
|
||||||
* Note: The dumper library does not support writing to disk, so we have to write to the local filesystem first.
|
* Note: The dumper library does not support writing to disk, so we have to write to the local filesystem first.
|
||||||
* Pattern: "animethemes-db-dump-wiki-{milliseconds from epoch}.sql".
|
* Pattern: "animethemes-db-dump-wiki-{milliseconds from epoch}.sql".
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
protected function getDumpFile(): string
|
protected function getDumpFile(): string
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -13,17 +13,12 @@ use Illuminate\Support\Facades\Config;
|
|||||||
use Illuminate\Support\Facades\Date;
|
use Illuminate\Support\Facades\Date;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class PruneDumpAction.
|
|
||||||
*/
|
|
||||||
class PruneDumpAction extends PruneAction
|
class PruneDumpAction extends PruneAction
|
||||||
{
|
{
|
||||||
use ReconcilesDumpRepositories;
|
use ReconcilesDumpRepositories;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The name of the disk.
|
* The name of the disk.
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
public function disk(): string
|
public function disk(): string
|
||||||
{
|
{
|
||||||
@@ -32,10 +27,6 @@ class PruneDumpAction extends PruneAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine whether the file should be pruned.
|
* Determine whether the file should be pruned.
|
||||||
*
|
|
||||||
* @param string $path
|
|
||||||
* @param Carbon $lastModified
|
|
||||||
* @return bool
|
|
||||||
*/
|
*/
|
||||||
protected function shouldBePruned(string $path, Carbon $lastModified): bool
|
protected function shouldBePruned(string $path, Carbon $lastModified): bool
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -19,16 +19,12 @@ use Illuminate\Support\Facades\Storage;
|
|||||||
abstract class DeleteAction implements InteractsWithDisks, StorageAction
|
abstract class DeleteAction implements InteractsWithDisks, StorageAction
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Create a new action instance.
|
|
||||||
*
|
|
||||||
* @param TModel $model
|
* @param TModel $model
|
||||||
*/
|
*/
|
||||||
public function __construct(protected BaseModel $model) {}
|
public function __construct(protected BaseModel $model) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle action.
|
* Handle action.
|
||||||
*
|
|
||||||
* @return StorageResults
|
|
||||||
*/
|
*/
|
||||||
public function handle(): StorageResults
|
public function handle(): StorageResults
|
||||||
{
|
{
|
||||||
@@ -49,7 +45,6 @@ abstract class DeleteAction implements InteractsWithDisks, StorageAction
|
|||||||
/**
|
/**
|
||||||
* Processes to be completed after handling action.
|
* Processes to be completed after handling action.
|
||||||
*
|
*
|
||||||
* @param StorageResults $storageResults
|
|
||||||
* @return TModel
|
* @return TModel
|
||||||
*/
|
*/
|
||||||
public function then(StorageResults $storageResults): BaseModel
|
public function then(StorageResults $storageResults): BaseModel
|
||||||
@@ -61,8 +56,6 @@ abstract class DeleteAction implements InteractsWithDisks, StorageAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the path to delete.
|
* Get the path to delete.
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
abstract protected function path(): string;
|
abstract protected function path(): string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,23 +12,15 @@ use Illuminate\Console\Command;
|
|||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class DeleteResults.
|
|
||||||
*/
|
|
||||||
readonly class DeleteResults implements StorageResults
|
readonly class DeleteResults implements StorageResults
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Create a new action result instance.
|
|
||||||
*
|
|
||||||
* @param BaseModel $model
|
|
||||||
* @param array<string, bool> $deletions
|
* @param array<string, bool> $deletions
|
||||||
*/
|
*/
|
||||||
public function __construct(protected BaseModel $model, protected array $deletions = []) {}
|
public function __construct(protected BaseModel $model, protected array $deletions = []) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write results to log.
|
* Write results to log.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function toLog(): void
|
public function toLog(): void
|
||||||
{
|
{
|
||||||
@@ -44,9 +36,6 @@ readonly class DeleteResults implements StorageResults
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Write results to console output.
|
* Write results to console output.
|
||||||
*
|
|
||||||
* @param Command $command
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function toConsole(Command $command): void
|
public function toConsole(Command $command): void
|
||||||
{
|
{
|
||||||
@@ -62,8 +51,6 @@ readonly class DeleteResults implements StorageResults
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Transform to Action Result.
|
* Transform to Action Result.
|
||||||
*
|
|
||||||
* @return ActionResult
|
|
||||||
*/
|
*/
|
||||||
public function toActionResult(): ActionResult
|
public function toActionResult(): ActionResult
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -19,16 +19,12 @@ use Illuminate\Support\Facades\Storage;
|
|||||||
abstract class MoveAction implements InteractsWithDisks, StorageAction
|
abstract class MoveAction implements InteractsWithDisks, StorageAction
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Create a new action instance.
|
|
||||||
*
|
|
||||||
* @param TModel $model
|
* @param TModel $model
|
||||||
*/
|
*/
|
||||||
public function __construct(protected BaseModel $model, protected readonly string $to) {}
|
public function __construct(protected BaseModel $model, protected readonly string $to) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle action.
|
* Handle action.
|
||||||
*
|
|
||||||
* @return StorageResults
|
|
||||||
*/
|
*/
|
||||||
public function handle(): StorageResults
|
public function handle(): StorageResults
|
||||||
{
|
{
|
||||||
@@ -51,7 +47,6 @@ abstract class MoveAction implements InteractsWithDisks, StorageAction
|
|||||||
/**
|
/**
|
||||||
* Processes to be completed after handling action.
|
* Processes to be completed after handling action.
|
||||||
*
|
*
|
||||||
* @param StorageResults $storageResults
|
|
||||||
* @return TModel
|
* @return TModel
|
||||||
*/
|
*/
|
||||||
public function then(StorageResults $storageResults): BaseModel
|
public function then(StorageResults $storageResults): BaseModel
|
||||||
@@ -61,8 +56,6 @@ abstract class MoveAction implements InteractsWithDisks, StorageAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the path to move from.
|
* Get the path to move from.
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
abstract protected function from(): string;
|
abstract protected function from(): string;
|
||||||
|
|
||||||
|
|||||||
@@ -12,17 +12,9 @@ use Illuminate\Console\Command;
|
|||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class MoveResults.
|
|
||||||
*/
|
|
||||||
readonly class MoveResults implements StorageResults
|
readonly class MoveResults implements StorageResults
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Create a new action result instance.
|
|
||||||
*
|
|
||||||
* @param BaseModel $model
|
|
||||||
* @param string $from
|
|
||||||
* @param string $to
|
|
||||||
* @param array<string, bool> $moves
|
* @param array<string, bool> $moves
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
@@ -34,8 +26,6 @@ readonly class MoveResults implements StorageResults
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Write results to log.
|
* Write results to log.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function toLog(): void
|
public function toLog(): void
|
||||||
{
|
{
|
||||||
@@ -51,9 +41,6 @@ readonly class MoveResults implements StorageResults
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Write results to console output.
|
* Write results to console output.
|
||||||
*
|
|
||||||
* @param Command $command
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function toConsole(Command $command): void
|
public function toConsole(Command $command): void
|
||||||
{
|
{
|
||||||
@@ -69,8 +56,6 @@ readonly class MoveResults implements StorageResults
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Transform to Action Result.
|
* Transform to Action Result.
|
||||||
*
|
|
||||||
* @return ActionResult
|
|
||||||
*/
|
*/
|
||||||
public function toActionResult(): ActionResult
|
public function toActionResult(): ActionResult
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -13,24 +13,14 @@ use Illuminate\Support\Carbon;
|
|||||||
use Illuminate\Support\Facades\Date;
|
use Illuminate\Support\Facades\Date;
|
||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class PruneAction.
|
|
||||||
*/
|
|
||||||
abstract class PruneAction implements InteractsWithDisk, StorageAction
|
abstract class PruneAction implements InteractsWithDisk, StorageAction
|
||||||
{
|
{
|
||||||
use ReconcilesRepositories;
|
use ReconcilesRepositories;
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new action instance.
|
|
||||||
*
|
|
||||||
* @param int $hours
|
|
||||||
*/
|
|
||||||
public function __construct(protected readonly int $hours = 72) {}
|
public function __construct(protected readonly int $hours = 72) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle action.
|
* Handle action.
|
||||||
*
|
|
||||||
* @return StorageResults
|
|
||||||
*/
|
*/
|
||||||
public function handle(): StorageResults
|
public function handle(): StorageResults
|
||||||
{
|
{
|
||||||
@@ -54,9 +44,6 @@ abstract class PruneAction implements InteractsWithDisk, StorageAction
|
|||||||
/**
|
/**
|
||||||
* Processes to be completed after handling action.
|
* Processes to be completed after handling action.
|
||||||
*
|
*
|
||||||
* @param StorageResults $storageResults
|
|
||||||
* @return null
|
|
||||||
*
|
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function then(StorageResults $storageResults): null
|
public function then(StorageResults $storageResults): null
|
||||||
@@ -70,10 +57,6 @@ abstract class PruneAction implements InteractsWithDisk, StorageAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine whether the file should be pruned.
|
* Determine whether the file should be pruned.
|
||||||
*
|
|
||||||
* @param string $path
|
|
||||||
* @param Carbon $lastModified
|
|
||||||
* @return bool
|
|
||||||
*/
|
*/
|
||||||
abstract protected function shouldBePruned(string $path, Carbon $lastModified): bool;
|
abstract protected function shouldBePruned(string $path, Carbon $lastModified): bool;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,23 +11,15 @@ use Illuminate\Console\Command;
|
|||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class PruneResults.
|
|
||||||
*/
|
|
||||||
readonly class PruneResults implements StorageResults
|
readonly class PruneResults implements StorageResults
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Create a new action result instance.
|
|
||||||
*
|
|
||||||
* @param string $fs
|
|
||||||
* @param array<string, bool> $prunings
|
* @param array<string, bool> $prunings
|
||||||
*/
|
*/
|
||||||
public function __construct(protected string $fs, protected array $prunings = []) {}
|
public function __construct(protected string $fs, protected array $prunings = []) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write results to log.
|
* Write results to log.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function toLog(): void
|
public function toLog(): void
|
||||||
{
|
{
|
||||||
@@ -43,9 +35,6 @@ readonly class PruneResults implements StorageResults
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Write results to console output.
|
* Write results to console output.
|
||||||
*
|
|
||||||
* @param Command $command
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function toConsole(Command $command): void
|
public function toConsole(Command $command): void
|
||||||
{
|
{
|
||||||
@@ -61,8 +50,6 @@ readonly class PruneResults implements StorageResults
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Transform to Action Result.
|
* Transform to Action Result.
|
||||||
*
|
|
||||||
* @return ActionResult
|
|
||||||
*/
|
*/
|
||||||
public function toActionResult(): ActionResult
|
public function toActionResult(): ActionResult
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -11,23 +11,12 @@ use Illuminate\Filesystem\FilesystemAdapter;
|
|||||||
use Illuminate\Http\UploadedFile;
|
use Illuminate\Http\UploadedFile;
|
||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class UploadAction.
|
|
||||||
*/
|
|
||||||
abstract class UploadAction implements InteractsWithDisks, StorageAction
|
abstract class UploadAction implements InteractsWithDisks, StorageAction
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Create a new action instance.
|
|
||||||
*
|
|
||||||
* @param UploadedFile $file
|
|
||||||
* @param string $path
|
|
||||||
*/
|
|
||||||
public function __construct(protected readonly UploadedFile $file, protected readonly string $path) {}
|
public function __construct(protected readonly UploadedFile $file, protected readonly string $path) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle action.
|
* Handle action.
|
||||||
*
|
|
||||||
* @return StorageResults
|
|
||||||
*/
|
*/
|
||||||
public function handle(): StorageResults
|
public function handle(): StorageResults
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -11,22 +11,15 @@ use Illuminate\Console\Command;
|
|||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class UploadResults.
|
|
||||||
*/
|
|
||||||
readonly class UploadResults implements StorageResults
|
readonly class UploadResults implements StorageResults
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Create a new action result instance.
|
|
||||||
*
|
|
||||||
* @param array<string, string|false> $uploads
|
* @param array<string, string|false> $uploads
|
||||||
*/
|
*/
|
||||||
public function __construct(protected array $uploads = []) {}
|
public function __construct(protected array $uploads = []) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write results to log.
|
* Write results to log.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function toLog(): void
|
public function toLog(): void
|
||||||
{
|
{
|
||||||
@@ -42,9 +35,6 @@ readonly class UploadResults implements StorageResults
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Write results to console output.
|
* Write results to console output.
|
||||||
*
|
|
||||||
* @param Command $command
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function toConsole(Command $command): void
|
public function toConsole(Command $command): void
|
||||||
{
|
{
|
||||||
@@ -60,8 +50,6 @@ readonly class UploadResults implements StorageResults
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Transform to Action Result.
|
* Transform to Action Result.
|
||||||
*
|
|
||||||
* @return ActionResult
|
|
||||||
*/
|
*/
|
||||||
public function toActionResult(): ActionResult
|
public function toActionResult(): ActionResult
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -16,11 +16,6 @@ use Illuminate\Support\Facades\Config;
|
|||||||
*/
|
*/
|
||||||
class DeleteAudioAction extends DeleteAction
|
class DeleteAudioAction extends DeleteAction
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Create a new action instance.
|
|
||||||
*
|
|
||||||
* @param Audio $audio
|
|
||||||
*/
|
|
||||||
public function __construct(Audio $audio)
|
public function __construct(Audio $audio)
|
||||||
{
|
{
|
||||||
parent::__construct($audio);
|
parent::__construct($audio);
|
||||||
@@ -28,8 +23,6 @@ class DeleteAudioAction extends DeleteAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The list of disk names.
|
* The list of disk names.
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
*/
|
||||||
public function disks(): array
|
public function disks(): array
|
||||||
{
|
{
|
||||||
@@ -38,8 +31,6 @@ class DeleteAudioAction extends DeleteAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the path to delete.
|
* Get the path to delete.
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
protected function path(): string
|
protected function path(): string
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -17,12 +17,6 @@ use Illuminate\Support\Facades\File;
|
|||||||
*/
|
*/
|
||||||
class MoveAudioAction extends MoveAction
|
class MoveAudioAction extends MoveAction
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Create a new action instance.
|
|
||||||
*
|
|
||||||
* @param Audio $audio
|
|
||||||
* @param string $to
|
|
||||||
*/
|
|
||||||
public function __construct(Audio $audio, string $to)
|
public function __construct(Audio $audio, string $to)
|
||||||
{
|
{
|
||||||
parent::__construct($audio, $to);
|
parent::__construct($audio, $to);
|
||||||
@@ -40,8 +34,6 @@ class MoveAudioAction extends MoveAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the path to move from.
|
* Get the path to move from.
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
protected function from(): string
|
protected function from(): string
|
||||||
{
|
{
|
||||||
@@ -52,8 +44,6 @@ class MoveAudioAction extends MoveAction
|
|||||||
* Update underlying model.
|
* Update underlying model.
|
||||||
* We want to apply these updates through Eloquent to preserve relations when renaming.
|
* We want to apply these updates through Eloquent to preserve relations when renaming.
|
||||||
* Otherwise, reconciliation would destroy the old model and create a new model for the new name.
|
* Otherwise, reconciliation would destroy the old model and create a new model for the new name.
|
||||||
*
|
|
||||||
* @return Audio
|
|
||||||
*/
|
*/
|
||||||
protected function update(): Audio
|
protected function update(): Audio
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,16 +12,10 @@ use Illuminate\Support\Facades\Config;
|
|||||||
use Illuminate\Support\Facades\File;
|
use Illuminate\Support\Facades\File;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class UploadAudioAction.
|
|
||||||
*/
|
|
||||||
class UploadAudioAction extends UploadAction
|
class UploadAudioAction extends UploadAction
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Processes to be completed after handling action.
|
* Processes to be completed after handling action.
|
||||||
*
|
|
||||||
* @param StorageResults $storageResults
|
|
||||||
* @return Audio|null
|
|
||||||
*/
|
*/
|
||||||
public function then(StorageResults $storageResults): ?Audio
|
public function then(StorageResults $storageResults): ?Audio
|
||||||
{
|
{
|
||||||
@@ -34,8 +28,6 @@ class UploadAudioAction extends UploadAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get existing or create new audio for file upload.
|
* Get existing or create new audio for file upload.
|
||||||
*
|
|
||||||
* @return Audio
|
|
||||||
*/
|
*/
|
||||||
protected function getOrCreateAudio(): Audio
|
protected function getOrCreateAudio(): Audio
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -17,12 +17,6 @@ use Illuminate\Support\Facades\Config;
|
|||||||
*/
|
*/
|
||||||
class MoveImageAction extends MoveAction
|
class MoveImageAction extends MoveAction
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Create a new action instance.
|
|
||||||
*
|
|
||||||
* @param Image $image
|
|
||||||
* @param string $to
|
|
||||||
*/
|
|
||||||
public function __construct(Image $image, string $to)
|
public function __construct(Image $image, string $to)
|
||||||
{
|
{
|
||||||
parent::__construct($image, $to);
|
parent::__construct($image, $to);
|
||||||
@@ -40,8 +34,6 @@ class MoveImageAction extends MoveAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the path to move from.
|
* Get the path to move from.
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
protected function from(): string
|
protected function from(): string
|
||||||
{
|
{
|
||||||
@@ -52,8 +44,6 @@ class MoveImageAction extends MoveAction
|
|||||||
* Update underlying model.
|
* Update underlying model.
|
||||||
* We want to apply these updates through Eloquent to preserve relations when renaming.
|
* We want to apply these updates through Eloquent to preserve relations when renaming.
|
||||||
* Otherwise, reconciliation would destroy the old model and create a new model for the new name.
|
* Otherwise, reconciliation would destroy the old model and create a new model for the new name.
|
||||||
*
|
|
||||||
* @return Image
|
|
||||||
*/
|
*/
|
||||||
protected function update(): Image
|
protected function update(): Image
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,9 +9,6 @@ use Illuminate\Support\Arr;
|
|||||||
use Illuminate\Support\Facades\Process;
|
use Illuminate\Support\Facades\Process;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class UploadedFileAction.
|
|
||||||
*/
|
|
||||||
class UploadedFileAction
|
class UploadedFileAction
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@@ -28,11 +25,6 @@ class UploadedFileAction
|
|||||||
*/
|
*/
|
||||||
public array $loudnessStats = [];
|
public array $loudnessStats = [];
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new action instance.
|
|
||||||
*
|
|
||||||
* @param UploadedFile $file
|
|
||||||
*/
|
|
||||||
public function __construct(protected UploadedFile $file)
|
public function __construct(protected UploadedFile $file)
|
||||||
{
|
{
|
||||||
$this->setFFprobeData();
|
$this->setFFprobeData();
|
||||||
@@ -40,8 +32,6 @@ class UploadedFileAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the FFprobe data for the uploaded file.
|
* Set the FFprobe data for the uploaded file.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
protected function setFFprobeData(): void
|
protected function setFFprobeData(): void
|
||||||
{
|
{
|
||||||
@@ -102,8 +92,6 @@ class UploadedFileAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the resolution.
|
* Get the resolution.
|
||||||
*
|
|
||||||
* @return int
|
|
||||||
*/
|
*/
|
||||||
public function resolution(): int
|
public function resolution(): int
|
||||||
{
|
{
|
||||||
@@ -147,9 +135,6 @@ class UploadedFileAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Format FFprobe command.
|
* Format FFprobe command.
|
||||||
*
|
|
||||||
* @param UploadedFile $file
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
public static function formatFfprobeCommand(UploadedFile $file): string
|
public static function formatFfprobeCommand(UploadedFile $file): string
|
||||||
{
|
{
|
||||||
@@ -170,9 +155,6 @@ class UploadedFileAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Format loudness command.
|
* Format loudness command.
|
||||||
*
|
|
||||||
* @param UploadedFile $file
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
public static function formatLoudnessCommand(UploadedFile $file): string
|
public static function formatLoudnessCommand(UploadedFile $file): string
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -16,11 +16,6 @@ use Illuminate\Support\Facades\Config;
|
|||||||
*/
|
*/
|
||||||
class DeleteVideoAction extends DeleteAction
|
class DeleteVideoAction extends DeleteAction
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Create a new action instance.
|
|
||||||
*
|
|
||||||
* @param Video $video
|
|
||||||
*/
|
|
||||||
public function __construct(Video $video)
|
public function __construct(Video $video)
|
||||||
{
|
{
|
||||||
parent::__construct($video);
|
parent::__construct($video);
|
||||||
@@ -38,8 +33,6 @@ class DeleteVideoAction extends DeleteAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the path to delete.
|
* Get the path to delete.
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
protected function path(): string
|
protected function path(): string
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -17,12 +17,6 @@ use Illuminate\Support\Facades\File;
|
|||||||
*/
|
*/
|
||||||
class MoveVideoAction extends MoveAction
|
class MoveVideoAction extends MoveAction
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Create a new action instance.
|
|
||||||
*
|
|
||||||
* @param Video $video
|
|
||||||
* @param string $to
|
|
||||||
*/
|
|
||||||
public function __construct(Video $video, string $to)
|
public function __construct(Video $video, string $to)
|
||||||
{
|
{
|
||||||
parent::__construct($video, $to);
|
parent::__construct($video, $to);
|
||||||
@@ -40,8 +34,6 @@ class MoveVideoAction extends MoveAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the path to move from.
|
* Get the path to move from.
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
protected function from(): string
|
protected function from(): string
|
||||||
{
|
{
|
||||||
@@ -52,8 +44,6 @@ class MoveVideoAction extends MoveAction
|
|||||||
* Update underlying model.
|
* Update underlying model.
|
||||||
* We want to apply these updates through Eloquent to preserve relations when renaming.
|
* We want to apply these updates through Eloquent to preserve relations when renaming.
|
||||||
* Otherwise, reconciliation would destroy the old model and create a new model for the new name.
|
* Otherwise, reconciliation would destroy the old model and create a new model for the new name.
|
||||||
*
|
|
||||||
* @return Video
|
|
||||||
*/
|
*/
|
||||||
protected function update(): Video
|
protected function update(): Video
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -17,11 +17,6 @@ use Illuminate\Support\Facades\Config;
|
|||||||
*/
|
*/
|
||||||
class DeleteScriptAction extends DeleteAction
|
class DeleteScriptAction extends DeleteAction
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Create a new action instance.
|
|
||||||
*
|
|
||||||
* @param VideoScript $script
|
|
||||||
*/
|
|
||||||
public function __construct(VideoScript $script)
|
public function __construct(VideoScript $script)
|
||||||
{
|
{
|
||||||
parent::__construct($script);
|
parent::__construct($script);
|
||||||
@@ -39,8 +34,6 @@ class DeleteScriptAction extends DeleteAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the path to delete.
|
* Get the path to delete.
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
protected function path(): string
|
protected function path(): string
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -17,12 +17,6 @@ use Illuminate\Support\Facades\Config;
|
|||||||
*/
|
*/
|
||||||
class MoveScriptAction extends MoveAction
|
class MoveScriptAction extends MoveAction
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Create a new action instance.
|
|
||||||
*
|
|
||||||
* @param VideoScript $script
|
|
||||||
* @param string $to
|
|
||||||
*/
|
|
||||||
public function __construct(VideoScript $script, string $to)
|
public function __construct(VideoScript $script, string $to)
|
||||||
{
|
{
|
||||||
parent::__construct($script, $to);
|
parent::__construct($script, $to);
|
||||||
@@ -40,8 +34,6 @@ class MoveScriptAction extends MoveAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the path to move from.
|
* Get the path to move from.
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
protected function from(): string
|
protected function from(): string
|
||||||
{
|
{
|
||||||
@@ -52,8 +44,6 @@ class MoveScriptAction extends MoveAction
|
|||||||
* Update underlying model.
|
* Update underlying model.
|
||||||
* We want to apply these updates through Eloquent to preserve relations when renaming.
|
* We want to apply these updates through Eloquent to preserve relations when renaming.
|
||||||
* Otherwise, reconciliation would destroy the old model and create a new model for the new name.
|
* Otherwise, reconciliation would destroy the old model and create a new model for the new name.
|
||||||
*
|
|
||||||
* @return VideoScript
|
|
||||||
*/
|
*/
|
||||||
protected function update(): VideoScript
|
protected function update(): VideoScript
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -14,18 +14,8 @@ use Illuminate\Support\Arr;
|
|||||||
use Illuminate\Support\Facades\Config;
|
use Illuminate\Support\Facades\Config;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class UploadScriptAction.
|
|
||||||
*/
|
|
||||||
class UploadScriptAction extends UploadAction
|
class UploadScriptAction extends UploadAction
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Create a new action instance.
|
|
||||||
*
|
|
||||||
* @param UploadedFile $file
|
|
||||||
* @param string $path
|
|
||||||
* @param Video|null $video
|
|
||||||
*/
|
|
||||||
public function __construct(UploadedFile $file, string $path, protected ?Video $video = null)
|
public function __construct(UploadedFile $file, string $path, protected ?Video $video = null)
|
||||||
{
|
{
|
||||||
parent::__construct($file, $path);
|
parent::__construct($file, $path);
|
||||||
@@ -33,9 +23,6 @@ class UploadScriptAction extends UploadAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Processes to be completed after handling action.
|
* Processes to be completed after handling action.
|
||||||
*
|
|
||||||
* @param StorageResults $storageResults
|
|
||||||
* @return VideoScript|null
|
|
||||||
*/
|
*/
|
||||||
public function then(StorageResults $storageResults): ?VideoScript
|
public function then(StorageResults $storageResults): ?VideoScript
|
||||||
{
|
{
|
||||||
@@ -48,8 +35,6 @@ class UploadScriptAction extends UploadAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get existing or create new script for file upload.
|
* Get existing or create new script for file upload.
|
||||||
*
|
|
||||||
* @return VideoScript
|
|
||||||
*/
|
*/
|
||||||
protected function getOrCreateScript(): VideoScript
|
protected function getOrCreateScript(): VideoScript
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -24,20 +24,10 @@ use Illuminate\Support\Facades\File;
|
|||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class UploadVideoAction.
|
|
||||||
*/
|
|
||||||
class UploadVideoAction extends UploadAction
|
class UploadVideoAction extends UploadAction
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Create a new action instance.
|
|
||||||
*
|
|
||||||
* @param UploadedFile $file
|
|
||||||
* @param string $path
|
|
||||||
* @param array $attributes
|
* @param array $attributes
|
||||||
* @param AnimeThemeEntry|null $entry
|
|
||||||
* @param UploadedFile|null $script
|
|
||||||
* @param User|null $encoder
|
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
UploadedFile $file,
|
UploadedFile $file,
|
||||||
@@ -53,9 +43,6 @@ class UploadVideoAction extends UploadAction
|
|||||||
/**
|
/**
|
||||||
* Processes to be completed after handling action.
|
* Processes to be completed after handling action.
|
||||||
*
|
*
|
||||||
* @param StorageResults $storageResults
|
|
||||||
* @return Video|null
|
|
||||||
*
|
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function then(StorageResults $storageResults): ?Video
|
public function then(StorageResults $storageResults): ?Video
|
||||||
@@ -89,8 +76,6 @@ class UploadVideoAction extends UploadAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get existing or create new video for file upload.
|
* Get existing or create new video for file upload.
|
||||||
*
|
|
||||||
* @return Video
|
|
||||||
*/
|
*/
|
||||||
protected function getOrCreateVideo(): Video
|
protected function getOrCreateVideo(): Video
|
||||||
{
|
{
|
||||||
@@ -138,9 +123,6 @@ class UploadVideoAction extends UploadAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Attach entry to created video if uploaded from entry detail screen.
|
* Attach entry to created video if uploaded from entry detail screen.
|
||||||
*
|
|
||||||
* @param Video $video
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
protected function attachEntry(Video $video): void
|
protected function attachEntry(Video $video): void
|
||||||
{
|
{
|
||||||
@@ -151,9 +133,6 @@ class UploadVideoAction extends UploadAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Upload & Associate Script if video upload was successful.
|
* Upload & Associate Script if video upload was successful.
|
||||||
*
|
|
||||||
* @param Video $video
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
protected function uploadScript(Video $video): void
|
protected function uploadScript(Video $video): void
|
||||||
{
|
{
|
||||||
@@ -168,9 +147,6 @@ class UploadVideoAction extends UploadAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Mark the encoder for the video.
|
* Mark the encoder for the video.
|
||||||
*
|
|
||||||
* @param Video $video
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
protected function markEncode(Video $video): void
|
protected function markEncode(Video $video): void
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -11,18 +11,10 @@ use App\Http\Api\Schema\Schema;
|
|||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class AggregatesFields.
|
|
||||||
*/
|
|
||||||
trait AggregatesFields
|
trait AggregatesFields
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Select aggregate fields for the query builder.
|
* Select aggregate fields for the query builder.
|
||||||
*
|
|
||||||
* @param Builder $builder
|
|
||||||
* @param Query $query
|
|
||||||
* @param Schema $schema
|
|
||||||
* @return Builder
|
|
||||||
*/
|
*/
|
||||||
public function withAggregates(Builder $builder, Query $query, Schema $schema): Builder
|
public function withAggregates(Builder $builder, Query $query, Schema $schema): Builder
|
||||||
{
|
{
|
||||||
@@ -35,11 +27,6 @@ trait AggregatesFields
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Load aggregate fields for the model.
|
* Load aggregate fields for the model.
|
||||||
*
|
|
||||||
* @param Model $model
|
|
||||||
* @param Query $query
|
|
||||||
* @param Schema $schema
|
|
||||||
* @return Model
|
|
||||||
*/
|
*/
|
||||||
public function loadAggregates(Model $model, Query $query, Schema $schema): Model
|
public function loadAggregates(Model $model, Query $query, Schema $schema): Model
|
||||||
{
|
{
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user