From 5482d47f0ca2a4fc60d87be6242443a8ae6823b2 Mon Sep 17 00:00:00 2001 From: philipp lang Date: Thu, 27 Jun 2024 17:41:54 +0200 Subject: [PATCH] Rename fileshare --- app/Fileshare/Actions/FileshareIndexAction.php | 6 +++--- app/Fileshare/Actions/FileshareStoreAction.php | 4 ++-- app/Fileshare/Actions/FileshareUpdateAction.php | 4 ++-- .../Models/{FileshareConnection.php => Fileshare.php} | 2 +- ...areConnectionResource.php => FileshareResource.php} | 4 ++-- ...shareConnectionFactory.php => FileshareFactory.php} | 10 +++++----- ...p => 2024_06_26_224159_create_fileshares_table.php} | 4 ++-- tests/Fileshare/FileshareIndexActionTest.php | 4 ++-- tests/Fileshare/FileshareStoreActionTest.php | 4 ++-- tests/Fileshare/FileshareUpdateActionTest.php | 8 ++++---- 10 files changed, 25 insertions(+), 25 deletions(-) rename app/Fileshare/Models/{FileshareConnection.php => Fileshare.php} (88%) rename app/Fileshare/Resources/{FileshareConnectionResource.php => FileshareResource.php} (92%) rename database/factories/Fileshare/Models/{FileshareConnectionFactory.php => FileshareFactory.php} (74%) rename database/migrations/{2024_06_26_224159_create_fileshare_connections_table.php => 2024_06_26_224159_create_fileshares_table.php} (80%) diff --git a/app/Fileshare/Actions/FileshareIndexAction.php b/app/Fileshare/Actions/FileshareIndexAction.php index 8a75e365..4aa80e13 100644 --- a/app/Fileshare/Actions/FileshareIndexAction.php +++ b/app/Fileshare/Actions/FileshareIndexAction.php @@ -2,8 +2,8 @@ namespace App\Fileshare\Actions; -use App\Fileshare\Models\FileshareConnection; -use App\Fileshare\Resources\FileshareConnectionResource; +use App\Fileshare\Models\Fileshare; +use App\Fileshare\Resources\FileshareResource; use Inertia\Inertia; use Inertia\Response; use Lorisleiva\Actions\Concerns\AsAction; @@ -18,7 +18,7 @@ class FileshareIndexAction session()->put('title', 'Datei-Verbindungen'); return Inertia::render('fileshareconnection/Index', [ - 'data' => FileshareConnectionResource::collection(FileshareConnection::paginate(15)), + 'data' => FileshareResource::collection(Fileshare::paginate(15)), ]); } } diff --git a/app/Fileshare/Actions/FileshareStoreAction.php b/app/Fileshare/Actions/FileshareStoreAction.php index b868243a..54a59463 100644 --- a/app/Fileshare/Actions/FileshareStoreAction.php +++ b/app/Fileshare/Actions/FileshareStoreAction.php @@ -2,7 +2,7 @@ namespace App\Fileshare\Actions; -use App\Fileshare\Models\FileshareConnection; +use App\Fileshare\Models\Fileshare; use Illuminate\Validation\ValidationException; use Lorisleiva\Actions\ActionRequest; use Lorisleiva\Actions\Concerns\AsAction; @@ -31,7 +31,7 @@ class FileshareStoreAction throw ValidationException::withMessages(['type' => 'Verbindung fehlgeschlagen']); } - FileshareConnection::create([ + Fileshare::create([ ...$request->validated(), 'type' => $type, ]); diff --git a/app/Fileshare/Actions/FileshareUpdateAction.php b/app/Fileshare/Actions/FileshareUpdateAction.php index b10d6602..d0f77b13 100644 --- a/app/Fileshare/Actions/FileshareUpdateAction.php +++ b/app/Fileshare/Actions/FileshareUpdateAction.php @@ -2,7 +2,7 @@ namespace App\Fileshare\Actions; -use App\Fileshare\Models\FileshareConnection; +use App\Fileshare\Models\Fileshare; use Illuminate\Validation\ValidationException; use Lorisleiva\Actions\ActionRequest; use Lorisleiva\Actions\Concerns\AsAction; @@ -23,7 +23,7 @@ class FileshareUpdateAction ]; } - public function handle(ActionRequest $request, FileshareConnection $fileshare): void + public function handle(ActionRequest $request, Fileshare $fileshare): void { $type = $request->input('type')::from($request->input('config')); diff --git a/app/Fileshare/Models/FileshareConnection.php b/app/Fileshare/Models/Fileshare.php similarity index 88% rename from app/Fileshare/Models/FileshareConnection.php rename to app/Fileshare/Models/Fileshare.php index aafa0a7b..e659e67f 100644 --- a/app/Fileshare/Models/FileshareConnection.php +++ b/app/Fileshare/Models/Fileshare.php @@ -6,7 +6,7 @@ use App\Fileshare\ConnectionTypes\ConnectionType; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; -class FileshareConnection extends Model +class Fileshare extends Model { use HasFactory; diff --git a/app/Fileshare/Resources/FileshareConnectionResource.php b/app/Fileshare/Resources/FileshareResource.php similarity index 92% rename from app/Fileshare/Resources/FileshareConnectionResource.php rename to app/Fileshare/Resources/FileshareResource.php index 5bd3b509..c9102e39 100644 --- a/app/Fileshare/Resources/FileshareConnectionResource.php +++ b/app/Fileshare/Resources/FileshareResource.php @@ -3,14 +3,14 @@ namespace App\Fileshare\Resources; use App\Fileshare\ConnectionTypes\ConnectionType; -use App\Fileshare\Models\FileshareConnection; +use App\Fileshare\Models\Fileshare; use App\Lib\HasMeta; use Illuminate\Http\Resources\Json\JsonResource; /** * @mixin FileshareConnection */ -class FileshareConnectionResource extends JsonResource +class FileshareResource extends JsonResource { use HasMeta; diff --git a/database/factories/Fileshare/Models/FileshareConnectionFactory.php b/database/factories/Fileshare/Models/FileshareFactory.php similarity index 74% rename from database/factories/Fileshare/Models/FileshareConnectionFactory.php rename to database/factories/Fileshare/Models/FileshareFactory.php index 9e48f6af..4debefe5 100644 --- a/database/factories/Fileshare/Models/FileshareConnectionFactory.php +++ b/database/factories/Fileshare/Models/FileshareFactory.php @@ -3,20 +3,20 @@ namespace Database\Factories\Fileshare\Models; use App\Fileshare\ConnectionTypes\ConnectionType; -use App\Fileshare\Models\FileshareConnection; +use App\Fileshare\Models\Fileshare; use Illuminate\Database\Eloquent\Factories\Factory; /** - * @extends Factory + * @extends Factory */ -class FileshareConnectionFactory extends Factory +class FileshareFactory extends Factory { /** * The name of the factory's corresponding model. * - * @var class-string + * @var class-string */ - protected $model = FileshareConnection::class; + protected $model = Fileshare::class; /** * Define the model's default state. diff --git a/database/migrations/2024_06_26_224159_create_fileshare_connections_table.php b/database/migrations/2024_06_26_224159_create_fileshares_table.php similarity index 80% rename from database/migrations/2024_06_26_224159_create_fileshare_connections_table.php rename to database/migrations/2024_06_26_224159_create_fileshares_table.php index bc2f1e5d..093c0d9d 100644 --- a/database/migrations/2024_06_26_224159_create_fileshare_connections_table.php +++ b/database/migrations/2024_06_26_224159_create_fileshares_table.php @@ -13,7 +13,7 @@ return new class extends Migration */ public function up() { - Schema::create('fileshare_connections', function (Blueprint $table) { + Schema::create('fileshares', function (Blueprint $table) { $table->id(); $table->string('name'); $table->json('type'); @@ -28,6 +28,6 @@ return new class extends Migration */ public function down() { - Schema::dropIfExists('fileshare_connections'); + Schema::dropIfExists('fileshares'); } }; diff --git a/tests/Fileshare/FileshareIndexActionTest.php b/tests/Fileshare/FileshareIndexActionTest.php index ad3312b7..6add6779 100644 --- a/tests/Fileshare/FileshareIndexActionTest.php +++ b/tests/Fileshare/FileshareIndexActionTest.php @@ -3,7 +3,7 @@ namespace Tests\Fileshare; use App\Fileshare\ConnectionTypes\OwncloudConnection; -use App\Fileshare\Models\FileshareConnection; +use App\Fileshare\Models\Fileshare; use Tests\FileshareTestCase; class FileshareIndexActionTest extends FileshareTestCase @@ -11,7 +11,7 @@ class FileshareIndexActionTest extends FileshareTestCase public function testItListsOwncloudConnectionsThatAreActive(): void { $this->withoutExceptionHandling()->login()->loginNami()->withOwncloudUser('badenpowell', 'secret'); - $connection = FileshareConnection::factory() + $connection = Fileshare::factory() ->type(OwncloudConnection::from(['user' => 'badenpowell', 'password' => 'secret', 'base_url' => env('TEST_OWNCLOUD_DOMAIN')])) ->name('lokaler Server') ->create(); diff --git a/tests/Fileshare/FileshareStoreActionTest.php b/tests/Fileshare/FileshareStoreActionTest.php index 447f2c15..46acf891 100644 --- a/tests/Fileshare/FileshareStoreActionTest.php +++ b/tests/Fileshare/FileshareStoreActionTest.php @@ -3,7 +3,7 @@ namespace Tests\Fileshare; use App\Fileshare\ConnectionTypes\OwncloudConnection; -use App\Fileshare\Models\FileshareConnection; +use App\Fileshare\Models\Fileshare; use Tests\FileshareTestCase; class FileshareStoreActionTest extends FileshareTestCase @@ -22,7 +22,7 @@ class FileshareStoreActionTest extends FileshareTestCase ] ])->assertOk(); - $connection = FileshareConnection::firstOrFail(); + $connection = Fileshare::firstOrFail(); $this->assertEquals('badenpowell', $connection->type->user); $this->assertEquals('secret', $connection->type->password); $this->assertEquals(env('TEST_OWNCLOUD_DOMAIN'), $connection->type->baseUrl); diff --git a/tests/Fileshare/FileshareUpdateActionTest.php b/tests/Fileshare/FileshareUpdateActionTest.php index d725a1de..5cdeffd0 100644 --- a/tests/Fileshare/FileshareUpdateActionTest.php +++ b/tests/Fileshare/FileshareUpdateActionTest.php @@ -3,7 +3,7 @@ namespace Tests\Fileshare; use App\Fileshare\ConnectionTypes\OwncloudConnection; -use App\Fileshare\Models\FileshareConnection; +use App\Fileshare\Models\Fileshare; use Tests\FileshareTestCase; class FileshareUpdateActionTest extends FileshareTestCase @@ -12,7 +12,7 @@ class FileshareUpdateActionTest extends FileshareTestCase { $this->withoutExceptionHandling()->login()->loginNami()->withOwncloudUser('badenpowell', 'secret'); - $connection = FileshareConnection::factory() + $connection = Fileshare::factory() ->type(OwncloudConnection::from(['user' => 'test', 'password' => 'test', 'base_url' => env('TEST_OWNCLOUD_DOMAIN')])) ->name('lokaler Server') ->create(); @@ -27,7 +27,7 @@ class FileshareUpdateActionTest extends FileshareTestCase ] ])->assertOk(); - $connection = FileshareConnection::firstOrFail(); + $connection = Fileshare::firstOrFail(); $this->assertEquals('badenpowell', $connection->type->user); $this->assertEquals('secret', $connection->type->password); $this->assertEquals(env('TEST_OWNCLOUD_DOMAIN'), $connection->type->baseUrl); @@ -38,7 +38,7 @@ class FileshareUpdateActionTest extends FileshareTestCase { $this->login()->loginNami()->withOwncloudUser('test', 'test'); - $connection = FileshareConnection::factory() + $connection = Fileshare::factory() ->type(OwncloudConnection::from(['user' => 'test', 'password' => 'test', 'base_url' => env('TEST_OWNCLOUD_DOMAIN')])) ->name('lokaler Server') ->create();