Rename fileshare
This commit is contained in:
parent
e1c3240290
commit
5482d47f0c
|
@ -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)),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
]);
|
||||
|
|
|
@ -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'));
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
@ -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;
|
|
@ -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<FileshareConnection>
|
||||
* @extends Factory<Fileshare>
|
||||
*/
|
||||
class FileshareConnectionFactory extends Factory
|
||||
class FileshareFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var class-string<FileshareConnection>
|
||||
* @var class-string<Fileshare>
|
||||
*/
|
||||
protected $model = FileshareConnection::class;
|
||||
protected $model = Fileshare::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
|
@ -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');
|
||||
}
|
||||
};
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue